Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fetch404's avatar

visit() and see() and all that not working

I decided to start doing tests to make my life easier, but I'm having one problem: Stuff like

$this->visit("/")->see("Laravel 5")

is not working. This is the error I get:

PHPUnit 4.6.6 by Sebastian Bergmann and contributors.

Configuration read from /var/www/booksite/phpunit.xml

PHP Fatal error:  Call to undefined method AuthTest::visit() in /var/www/booksite/tests/AuthTest.php on line 15
                                                      [Symfony\Component\Debug\Exception\FatalErrorException]   
Call to undefined method AuthTest::visit()            

My test:

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class AuthTest extends TestCase
{
    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $this->visit('/')
            ->see('Laravel 5');
    }
}

(The name AuthTest is for something else, I just want to get this working.)

Any idea what's going on?

0 likes
6 replies
davorminchorov's avatar

Did you install the integrated package or you are using the dev version (5.1)?

fetch404's avatar

@Ruffles Oh, I need the integrated package? I thought that stuff came in 5.0 :P

No, I'm not using 5.1.

bobbybouwmann's avatar

@Ruffles I posted that, but I thought he was on the beta of Laravel 5.1 so I deleted my comment :P

Like mentioned above follow the intuitive integration testing series to get started with that ;)

2 likes
connor11528's avatar

Dusk requires a lot of changes to your tests. To get tests working in a similar manner using >= Laravel 5.5 you can use:

composer require laravel/browser-kit-testing --dev

Full setup instructions here (it's not too bad): https://github.com/laravel/browser-kit-testing

I have the tests running in functional dir using Laravel 5.6!

3 likes

Please or to participate in this conversation.