create(); Faculty::factory()->create(); Department::factory()->create(); EducationLevel::factory()->create(); EducationForm::factory()->create(); Direction::factory()->create(); ExaminationType::factory()->create(); Subject::factory()->create(); SubjectType::factory()->create(); $this->entranceExamination = EntranceExamination::factory()->create(); $this->data = EntranceExamination::factory()->make()->only([ 'direction_id', 'examination_type_id', 'subject_id', 'subject_type_id', 'scores', 'position', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexEntranceExaminationsPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('entrance_examinations.index')); $response->assertOk(); } public function testCreateEntranceExaminationPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('entrance_examinations.create')); $response->assertOk(); } public function testStoreEntranceExamination(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('entrance_examinations.store', $this->data)); $response->assertRedirect(route('entrance_examinations.index')); $this->assertDatabaseHas('entrance_examinations', $this->data); } public function testShowEntranceExaminationPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('entrance_examinations.show', $this->entranceExamination)); $response->assertOk(); } public function testEditEntranceExaminationPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('entrance_examinations.edit', $this->entranceExamination)); $response->assertOk(); } public function testUpdateEntranceExamination(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('entrance_examinations.update', $this->entranceExamination), $this->data); $response->assertRedirect(route('entrance_examinations.index')); $this->assertDatabaseHas('entrance_examinations', $this->data); } public function testEntranceExaminationDirection(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->delete(route('entrance_examinations.destroy', $this->entranceExamination)); $response->assertRedirect(route('entrance_examinations.index')); $this->assertDatabaseMissing('entrance_examinations', $this->entranceExamination->toArray()); } }