That's the code for my unit test, the default one:
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}
I'm running the laravel project on: php artisan serv
When I manually access the /
the project works fine! however on the test I'm getting this error:
Expected status code 200 but received 500.
Failed asserting that 200 is identical to 500.
Here it is the full output:
FAIL Tests\Feature\ExampleTest
⨯ basic test
---
• Tests\Feature\ExampleTest > basic test
Expected status code 200 but received 500.
Failed asserting that 200 is identical to 500.
at tests/Feature/ExampleTest.php:19
15▕ public function testBasicTest()
16▕ {
17▕ $response = $this->get('/');
18▕
➜ 19▕ $response->assertStatus(200);
20▕ }
21▕ }
22▕
How can I fix that please?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire