dimanche 26 juin 2016

PHPUnit in LAravel error : Exception' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)'

I am trying to run phpunit ExampleTest in LAravel 5

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

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

and I am getting this error .

And when I run DB ::table('something')->get(); it's working fine.

   $ vendor/bin/phpunit
    PHPUnit 4.8.26 by Sebastian Bergmann and contributors.

    F

    Time: 11.75 seconds, Memory: 15.00MB

    There was 1 failure:

    1) ExampleTest::testBasicExample
    A request to [http://localhost] failed. Received status code [500].



    ..vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php:196home/zagorka/Desktop/docker/dockervel/www/
    ..vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php:80
    ..vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php:61
    /home/zagorka/Desktop/docker/dockervel/www/tests/ExampleTest.php:16

    Caused by
    exception 'PDOException' with message 'SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql' (2)' 
    in ../vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55

Someone sees the problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28UrfEA
via IFTTT

Aucun commentaire:

Enregistrer un commentaire