mardi 21 juin 2016

Laravel 5.2 Errors with Mysql and PHPunit using homestead

I installed laravel 5.2 using homestead. First of all, this is my database configuration inside .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

I started creating easy unit tests to validate a list of "categories" and the problem is that all is ok with the unit tests but then , when I check it into my browser these lists doesn't appear. This is the error message:

PDOException in Connector.php line 55: SQLSTATE[HY000] [2002]
Connection refused in Connector.php line 55 at
PDO->__construct('mysql:host=127.0.0.1;port=33060;dbname=homestead',
'homestead', 'secret', array('0', '2', '0', false, false)) in
Connector.php line 55

but I realised that if I change in my .env this DB_PORT=33060 for this DB_PORT=3306 I can see the "category" list in my browser but I can't pass my unit tests. This is the error message:

1) ExampleTest::testCreateCategory PDOException: SQLSTATE[HY000]
[2002] No such file or directory
/Users/myname/Code/http://ift.tt/28PirSa

I can't figure out how fix it for work with both things properly.

I can work changing all the time this port but I want to work more comfortable without think in this trouble..

Aucun commentaire:

Enregistrer un commentaire