Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnitTesting always failed. Expected status code 200 but received 307. #17

Open
mlopez-aeduc opened this issue Mar 15, 2019 · 1 comment

Comments

@mlopez-aeduc
Copy link

mlopez-aeduc commented Mar 15, 2019

When I run PHPUnit from a broker the system always throws the following error:

<?php

namespace Tests\Unit;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $this->assertTrue(true);
    }
}
PHPUnit 7.5.6 by Sebastian Bergmann and contributors.

.F 2/2 (100%)

Time: 160 ms, Memory: 18.00 MB

There was 1 failure:

1) Tests \ Feature \ ExampleTest :: testBasicTest
Expected status code 200 but received 307.
Failed asserting that false is true.

I think the system tries to redirect to the server from the broker and that's why it gives error 307.

Any idea how to fix it?

@mlopez-aeduc
Copy link
Author

nvm...

maybe this is the solution... edit the file tests/TestCase.php

<?php

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication, WithoutMiddleware;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant