create(); Faculty::factory()->create(); Department::factory()->create(); EducationLevel::factory()->create(); EducationForm::factory()->create(); Direction::factory()->create(); $this->period = Period::factory()->create(); $this->data = Period::factory()->make()->only([ 'position', 'description', 'period', 'education_form_id', 'direction_id', ]); $this->user = User::factory()->create([ 'name' => 'admin', 'email' => 'test@example.com', 'password' => 123456 ]); } public function testIndexPeriodsPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('periods.index')); $response->assertOk(); } public function testCreatePeriodPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('periods.create')); $response->assertOk(); } public function testStorePeriod(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->post(route('periods.store', $this->data)); $response->assertRedirect(route('periods.index')); $this->assertDatabaseHas('periods', $this->data); } public function testShowPeriod(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('periods.show', $this->period)); $response->assertOk(); } public function testEditPeriodPage(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->get(route('periods.edit', $this->period)); $response->assertOk(); } public function testUpdatePeriod(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->patch(route('periods.update', $this->period), $this->data); $response->assertRedirect(route('periods.index')); $this->assertDatabaseHas('periods', $this->data); } public function testDestroyPeriod(): void { $response = $this->actingAs($this->user) ->withSession(['banned' => false]) ->delete(route('periods.destroy', $this->period)); $response->assertRedirect(route('periods.index')); $this->assertDatabaseMissing('periods', $this->period->toArray()); } }