create(); Faculty::factory()->create(); Department::factory()->create(); EducationLevel::factory()->create(); EducationForm::factory()->create(); Direction::factory()->create(); $this->directionProfile = DirectionProfile::factory()->create(); $this->data = DirectionProfile::factory()->make()->only([ 'name', 'position', 'description', 'slug', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexDirectionProfilesPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('direction_profiles.index')); $response->assertOk(); } public function testCreateDirectionProfilePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('direction_profiles.create')); $response->assertOk(); } public function testStoreDirectionProfile(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('direction_profiles.store', $this->data)); $response->assertRedirect(route('direction_profiles.index')); $this->assertDatabaseHas('direction_profiles', $this->data); } public function testShowDirectionProfilePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('direction_profiles.show', $this->directionProfile)); $response->assertOk(); } public function testEditDirectionProfilePage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('direction_profiles.edit', $this->directionProfile)); $response->assertOk(); } public function testUpdateDirectionProfile(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('direction_profiles.update', $this->directionProfile), $this->data); $response->assertRedirect(route('direction_profiles.index')); $this->assertDatabaseHas('direction_profiles', $this->data); } public function testDestroyDirectionProfile(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->delete(route('direction_profiles.destroy', $this->directionProfile)); $response->assertRedirect(route('direction_profiles.index')); $this->assertDatabaseMissing('direction_profiles', $this->directionProfile->toArray()); } }