Closed crissi closed 6 years ago
Hi, was on holiday last week.
Please provide example test & output that you got VS what you'd expect to see.
This code
Route::get('play', function()
{
return redirect()->to('/verify/message');
});
This test:
fit('Test', function() {
$this->laravel->get('/play')
->assertRedirectedTo('/gosomeWhere');
});
Produce this exception:
x it Test an uncaught exception has been thrown in `C:\Users\crissi\AppData\Local\Temp\kahlan\G\laragon\www\Mengo\vendor\phpunit\phpunit\src\Framework\Constraint\IsEqual.php` line 137 message:`PHPUnit_Framework_ExpectationFailedException` Code(0) with message "Failed asserting that two strings are equal." [NA] - C:\Users\crissi\AppData\Local\Temp\kahlan\G\laragon\www\Mengo\vendor\phpunit\phpunit\src\Framework\Constraint\IsEqual.php, line to 137 PHPUnit_Framework_Constraint_IsEqual::evaluate() - C:\Users\crissi\AppData\Local\Temp\kahlan\G\laragon\www\Mengo\vendor\phpunit\phpunit\src\Framework\Assert.php, line 2184 PHPUnit_Framework_Assert::assertThat() - C:\Users\crissi\AppData\Local\Temp\kahlan\G\laragon\www\Mengo\vendor\phpunit\phpunit\src\Framework\Assert.php, line 513 PHPUnit_Framework_Assert::assertEquals() - C:\Users\crissi\AppData\Local\Temp\kahlan\G\laragon\www\Mengo\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php, line 761 Sofa\LaravelKahlan\Laravel::assertRedirectedTo() - G:\laragon\www\Mengo\spec\AuthSpec.php, line 157 Kahlan\Specification::_execute() - G:\laragon\www\Mengo\vendor\kahlan\kahlan\src\Specification.php, line 103 Kahlan\Specification::_process() - G:\laragon\www\Mengo\vendor\kahlan\kahlan\src\Specification.php, line 227 Kahlan\Specification::passed() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 314 Kahlan\Suite::_process() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 460 Kahlan\Suite::passed() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 314 Kahlan\Suite::_process() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 460 Kahlan\Suite::passed() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 314 Kahlan\Suite::_process() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 460 Kahlan\Suite::passed() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Suite.php, line 442 Kahlan\Suite::run() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Cli\Kahlan.php, line 593 Kahlan\Filter\Filter::on() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Cli\Kahlan.php, line 595 Kahlan\Cli\Kahlan::_run() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Cli\Kahlan.php, line 363 Kahlan\Filter\Filter::on() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\src\Cli\Kahlan.php, line 370 Kahlan\Cli\Kahlan::run() - C:\Users\crissi\AppData\Roaming\Composer\vendor\kahlan\kahlan\bin\kahlan, line 47
In PHPUNIT it looks like this:
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/gosomeWhere'
+'http://localhost/verify/message'
G:\laragon\www\Mengo\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php:761
G:\laragon\www\Mengo\tests\ValidatorTest.php:19
C:\Users\crissi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:185
C:\Users\crissi\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:115
Sometimes it is hard do debug your testing errors since we are missing the actual and expected value from the PHPUNIT exception.
Tried to find a way to this, but kind of got stuck.