Domain\Dashboard\Http\DashboardControllerTest::test_index PHP Method

test_index() public method

A basic test example.
public test_index ( ) : void
return void
    public function test_index()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        DB::select('DELETE from teachers');
        DB::select('DELETE from employees');
        DB::select('DELETE from students');
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
        $employees = factory(Employee::class, 10)->create();
        $students = factory(Student::class, 20)->create();
        $teachers = factory(Teacher::class, 45)->create();
        $employees->random(3)->each(function ($employee) {
            $employee->delete();
        });
        $students->random(8)->each(function ($student) {
            $student->delete();
        });
        $teachers->random(5)->each(function ($teacher) {
            $teacher->delete();
        });
        $this->get('api/v1/dashboard');
        $this->seeStatusCode(200);
        $this->seeJson(['employees' => ['registers' => 7, 'deletes' => 3], 'students' => ['registers' => 12, 'deletes' => 8], 'teachers' => ['registers' => 40, 'deletes' => 5]]);
    }
DashboardControllerTest