create(); EducationalInstitution::factory()->create(); Faculty::factory()->create(); Department::factory()->create(); EducationLevel::factory()->create(); EducationForm::factory()->create(); Direction::factory()->create(); $this->place = Place::factory()->create(); $this->data = Place::factory()->make()->only([ 'position', 'description', 'amount', 'education_form_id', 'place_type_id', 'direction_id', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexPlacesPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('places.index')); $response->assertOk(); } public function testCreatePlaceTypePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('places.create')); $response->assertOk(); } public function testStorePlaceType(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('places.store', $this->data)); $response->assertRedirect(route('places.index')); $this->assertDatabaseHas('places', $this->data); } public function testShowPlaceTypePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('places.show', $this->place)); $response->assertOk(); } public function testEditPlaceTypePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('places.edit', $this->place)); $response->assertOk(); } public function testUpdatePlaceType(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('places.update', $this->place), $this->data); $response->assertRedirect(route('places.index')); $this->assertDatabaseHas('places', $this->data); } public function testDestroyPlaceType(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->delete(route('places.destroy', $this->place)); $response->assertRedirect(route('places.index')); $this->assertDatabaseMissing('places', $this->place->toArray()); } }