Level 54
What could possibly be the cause for this to happen?
I have this simple test set up and I'm trying to find out why when I run this test I get this error message. When I visit myapp.app in my browser I see the welcome page for the install of Laravel 5.2.
There were 2 failures:
1) ExampleTest::testExample
A request to [myapp.app] failed. Received status code [404].
<?php
use Illuminate\Foundation\Testing\DatabaseTransactions;
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
use DatabaseTransactions;
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'myapp.app';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
return $app;
}
}
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->visit('/')
->see('Laravel 5');
}
}
The answer was I needed to make this change in my code.
protected $baseUrl = 'myapp.app';
to
protected $baseUrl = 'http://myapp.app';
Please or to participate in this conversation.