admission = Admission::factory()->create(); $this->data = Admission::factory()->make()->only([ 'position', 'name', 'description', 'slug', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexAdmissionsPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('admissions.index')); $response->assertOk(); } public function testCreateAdmissionPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('admissions.create')); $response->assertOk(); } public function testStoreAdmission(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('admissions.store', $this->data)); $response->assertRedirect(route('admissions.index')); $this->assertDatabaseHas('admissions', $this->data); } public function testShowAdmissionPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('admissions.show', $this->admission)); $response->assertOk(); } public function testEditAdmissionPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('admissions.edit', $this->admission)); $response->assertOk(); } public function testUpdateAdmission(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('admissions.update', $this->admission), $this->data); $response->assertRedirect(route('admissions.index')); $this->assertDatabaseHas('admissions', $this->data); } public function testDestroyFaculty(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->delete(route('admissions.destroy', $this->admission)); $response->assertRedirect(route('admissions.index')); $this->assertDatabaseMissing('faculties', $this->admission->toArray()); } }