Jun 24, 2020
0
Level 2
the basic example test failed( solved)
Update:
the reason is that the root path is only for authorized user, so the response is 302(redirect)
============================= I decide to learn test and tried with a old project. Here is result:
Warning: TTY mode is not supported on Windows platform.
RUNS Tests\Unit\ExampleTest
• basic test
Tests: 2 pending
PASS Tests\Unit\ExampleTest
✓ basic test
RUNS Tests\Feature\ExampleTest
• basic test
Tests: 1 passed, 1 pending
FAIL Tests\Feature\ExampleTest
✕ basic test
Tests: 1 failed, 1 passed
Expected status code 200 but received 302. Failed asserting that 200 is identical to 302.
at C:\apcom_projects\garage\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php:118
114| if (!empty($description)) {
115| $failureDescription = $description . "\n" . $failureDescription;
116| }
117|
> 118| throw new ExpectationFailedException(
119| $failureDescription,
120| $comparisonFailure
121| );
122| }
1 C:\apcom_projects\garage\vendor\phpunit\phpunit\src\Framework\Constraint\IsIdentical.php:93
PHPUnit\Framework\Constraint\Constraint::fail("Expected status code 200 but received 302.")
2 C:\apcom_projects\garage\vendor\phpunit\phpunit\src\Framework\Assert.php:2887
PHPUnit\Framework\Constraint\IsIdentical::evaluate("Expected status code 200 but received 302.")
I did not add or modify any test code. the project was recently updated from laravel 5.8 to 7, maybe I missed something during update??
Please or to participate in this conversation.