title: Laravel phpunit returns 404
body: <p>i am new in Laravel. Using local development environment with Homestead
  Try to run simple test</p>
  
  <pre><code>namespace Tests\Feature;
  
  use Tests\TestCase;
  use Illuminate\Foundation\Testing\RefreshDatabase;
  
  class UserTest extends TestCase
  {
      /**
       * A basic test example.
       *
       * @return void
       */
  
      public function testBasicTest()
      {
          $response = $this-&gt;get('/');
  
          $response-&gt;assertStatus(200);
      }
  }
  </code></pre>
  
  <p>routes/web.php :</p>
  
  <pre><code>Route::get('/', function () {
      return view('main');
  });
  
  Auth::routes();
  
  Route::get('/home', 'HomeController@index')-&gt;name('home');
  </code></pre>
  
  <p>running phpunit returns 404 error</p>
  
  <blockquote>
    <p>vagrant@homestead:~/code/laravel$ phpunit PHPUnit 6.4.3 by Sebastian
    Bergmann and contributors.</p>
    
    <p>.F.                                                                 3
    / 3 (100%)</p>
    
    <p>Time: 1.07 seconds, Memory: 10.00MB</p>
    
    <p>There was 1 failure:</p>
    
    <p>1) Tests\Feature\UserTest::testBasicTest Expected status code 200 but
    received 404. Failed asserting that false is true.</p>
    
    <p>/home/vagrant/code/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:78
    /home/vagrant/code/laravel/tests/Feature/UserTest.php:25</p>
  </blockquote>
  
  <p>I have tried to fix it with these ways</p>
  
  <p>1.
      <a href="https://stackoverflow.com/questions/38391255/laravel-phpunit-always-404">Laravel phpunit always 404</a>
      updateTestCase.php</p>
  
  <pre><code>    protected $baseUrl = 'http://localhost'
  
  change with
  
      protected $baseUrl = 'http://laravel.local'
  </code></pre>
  
  <p>2.
  <a href="https://github.com/dingo/api/issues/540" rel="noreferrer">https://github.com/dingo/api/issues/540</a> and next to it
      <a href="https://github.com/dingo/api/issues/571" rel="noreferrer">https://github.com/dingo/api/issues/571</a></p>
  
  <pre><code>    use Illuminate\Foundation\Testing\WithoutMiddleware;
      class BankTest extends TestCase {
          use WithoutMiddleware;
  </code></pre>
  
  <ol start="3">
  <li><p>Changing APP_URL in .env to</p>
  
  <pre><code>APP_URL=laravel.local
  </code></pre></li>
  </ol>
  
  <p>none of this helped</p>
  
  <p>'laravel.local' works fine in browser</p>
  
  <p>Please, help me fix it</p>