php - Symfony PDO Connection in Test Environment -
i have symfony environment running on docker setup. via docker-compose.yml (version 2) start several containers. following containers relevant here:
phpfpm, nginx , mariadb
if open symfony project via browser connects database (on container called "mariadb"). records tables in database displayed. if execute console commands update database schema work , changes applied database.
now want write functional / integration tests run test against second database on same host (mariadb).
this how try connect:
$dsn = sprintf( 'mysql:host=%s;port=%s', 'mariadb', 3306 ); $pdo = new pdoconnection( $dsn, 'otk_dbuser', 'testpass' );
but result following message:
sqlstate[hy000] [2002] php_network_getaddresses: getaddrinfo failed: name or service not known /opt/project/vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdoconnection.php:47 /opt/project/src/testingbundle/tests/databasetestcase.php:56 /opt/project/src/testingbundle/tests/databasetestcase.php:18
could please give me help?
kind regards, max
forget asked. executed functional test within phpstorm. phpstorm uses therefore standalone docker container, has nothing todo docker-compose setup.
dumb me!
Comments
Post a Comment