tommyc81's avatar

[5.1] Integration test issue - Symfony\Component\HttpFoundation\Response

Trying to set up some basic integration tests on Laravel 5.1 (upgraded from Laravel 5).

This is what the classes look like:

TestCase.php

<?php

class TestCase extends Illuminate\Foundation\Testing\TestCase
{

    /**
     * The base URL to use while testing the application.
     *
     * @var string
     */
    protected $baseUrl = 'http://localhost/testinstall';

    /**
     * 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;
    }
}

RouteTest.php:

<?php

class RouteTest extends TestCase
{

    public function testBasicRoute()
    {
        $this->visit('/')->see('Welcome to the Application');
    }

}

This test throws an error: ErrorException: Undefined property: Symfony\Component\HttpFoundation\Response::$exception

I have absolutely no idea what this is about, and can't find anything obvious that I'm missing. Hints appreciated!

0 likes
1 reply
tommyc81's avatar
tommyc81
OP
Best Answer
Level 1

Ok, progress.

Changed $baseUrl, and now it works. Both an empty string ("") and "http://localhost" works. Not sure why.

Please or to participate in this conversation.