Назад к задачамПолучайте помощь с лайвкодингом в реальном времени с Sobes Copilot
Junior
9
Что выведет консоль
Условие задачи
Что будет выведено в результате выполнения программы
<?php
namespace Tests\Feature\Http\Controllers;
use App\Models\User;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Tests\ControllerTestCase;
class UseControllerTest extends ControllerTestCase{
public function testShow() : void
{
$this -> actingAs($this->user);
$responce = $this -> get(route('users.show', $this->user));
$response->assertOk()
->assertSee($this ->user -> name);
}
public function testVisitByOtherUser(): void {
$visitor = User::factory()->create():
$this->actingAs($visitors);
$response = $this -> get(route('users.show', $this->user));
$response->assertOk()
->assertSee($this ->user -> name);
}
public function testVisitByGuest() : void{
$response = $this -> get(route('users.show', $this->user));
$response->assertOk()
->assertSee($this ->user -> name);
}
public function testInvalidShow(): void {
$this -> expectException(NotFoundHttpException::class);
$response = $this->get(route('user.show', ['user' => 'foo']));
$response ->assertNotFound():
}
}