{"action":"created","issue":{"url":"https://api.github.com/repos/laravel-doctrine/orm/issues/52","labels_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/52/comments","events_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/52/events","html_url":"https://github.com/laravel-doctrine/orm/issues/52","id":108848379,"number":52,"title":"Unit testing","user":{"login":"elceka","id":2307558,"avatar_url":"https://avatars.githubusercontent.com/u/2307558?v=3","gravatar_id":"","url":"https://api.github.com/users/elceka","html_url":"https://github.com/elceka","followers_url":"https://api.github.com/users/elceka/followers","following_url":"https://api.github.com/users/elceka/following{/other_user}","gists_url":"https://api.github.com/users/elceka/gists{/gist_id}","starred_url":"https://api.github.com/users/elceka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elceka/subscriptions","organizations_url":"https://api.github.com/users/elceka/orgs","repos_url":"https://api.github.com/users/elceka/repos","events_url":"https://api.github.com/users/elceka/events{/privacy}","received_events_url":"https://api.github.com/users/elceka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-29T11:14:04Z","updated_at":"2015-09-30T17:27:58Z","closed_at":null,"body":"Hi, please, how can i testing ORM library with PHP unit? I have environment configuration in phpunit.xml file for SQLITE memory database, but ORM library stay use default MYSQL configuration from database.php configuration file and mixing it with SQLITE testing configuration.\r\n\r\nI get this error from PHPUnit test environment (SQLSTATE[HY000] [1049] Unknown database ':memory:'):\r\n```\r\nFailed asserting that exception of type \"Doctrine\\DBAL\\Exception\\ConnectionException\" matches expected exception \"\\InvalidArgumentException\". Message was: \"An exception occured in driver: SQLSTATE[HY000] [1049] Unknown database ':memory:'\" at\r\n#0 /xxx\\DBAL\\Driver\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\DBAL\\Driver\\PDOException))\r\n#1 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(47): Doctrine\\DBAL\\DBALException::driverException(Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException))\r\n#2 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\\DBAL\\Driver\\PDOMySql\\Driver->connect(Array, 'user', 'password', Array)\r\n#3 /xxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1166): Doctrine\\DBAL\\Connection->connect()\r\n#4 /xxx/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(230): Doctrine\\DBAL\\Connection->beginTransaction()\r\n#5 /xxx/vendor/doctrine/data-fixtures/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php(85): Doctrine\\ORM\\EntityManager->transactional(Object(Closure))\r\n#6 /xxx/tests/phpunit/Application/Protocol/RetrieveProtocolsTest.php(69): Doctrine\\Common\\DataFixtures\\Executor\\ORMExecutor->execute(Array)\r\n#7 [internal function]: yyy\\Tests\\Application\\Protocol\\RetrieveProtocolsTest->testRetrieveProtocolsInvalidArgumentException()\r\n#8 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(881): ReflectionMethod->invokeArgs(Object(yyy\\Tests\\Application\\Protocol\\RetrieveProtocolsTest), Array)\r\n#9 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(746): PHPUnit_Framework_TestCase->runTest()\r\n#10 /xxx/vendor/phpunit/phpunit/src/Framework/TestResult.php(601): PHPUnit_Framework_TestCase->runBare()\r\n#11 /xxx/vendor/phpunit/phpunit/src/Framework/TestCase.php(702): PHPUnit_Framework_TestResult->run(Object(yyy\\Tests\\Application\\Protocol\\RetrieveProtocolsTest))\r\n#12 /xxx/vendor/phpunit/phpunit/src/Framework/TestSuite.php(735): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))\r\n#13 /xxx/vendor/phpunit/phpunit/src/Framework/TestSuite.php(735): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))\r\n#14 /xxx/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(432): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))\r\n#15 /xxx/vendor/phpunit/phpunit/src/TextUI/Command.php(148): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)\r\n#16 /xxx/vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(Array, true)\r\n#17 /xxx/vendor/phpunit/phpunit/phpunit(47): PHPUnit_TextUI_Command::main()\r\n#18 {main}.\r\n```\r\n\r\nDB environment configuration from phpunit.xml file:\r\n```xml\r\n<env name=\"APP_ENV\" value=\"testing\"/>\r\n<env name=\"APP_DEBUG\" value=\"true\"/>\r\n<env name=\"DB_CONNECTION\" value=\"sqlite\"/>\r\n<env name=\"DB_DRIVER\" value=\"sqlite\"/>\r\n<env name=\"DB_DATABASE\" value=\":memory:\"/>\r\n<env name=\"DOCTRINE_METADATA\" value=\"annotations\"/>\r\n<env name=\"DOCTRINE_PROXY_AUTOGENERATE\" value=\"true\"/>\r\n```\r\n\r\nConfiguration for sqlite connection from database.php file:\r\n```php\r\n'default' => env('DB_CONNECTION', 'mysql'),\r\n'connections' => array(\r\n    'mysql' => array(\r\n        ...\r\n    ),\r\n    'sqlite' => array(\r\n        'driver' => env('DB_DRIVER', 'sqlite'),\r\n        'database'  => env('DB_DATABASE'),\r\n        'prefix'   => ''\r\n    )\r\n)\r\n...\r\n```\r\n\r\nDB default manager configuration from doctrine.php configuration file:\r\n```php\r\n'managers' => [\r\n    'default' => [\r\n        'dev'        => env('APP_DEBUG'),\r\n        'meta'       => env('DOCTRINE_METADATA', 'annotations'),\r\n        'connection' => env('DB_CONNECTION'),\r\n...\r\n```\r\n\r\nThank You."},"comment":{"url":"https://api.github.com/repos/laravel-doctrine/orm/issues/comments/144483518","html_url":"https://github.com/laravel-doctrine/orm/issues/52#issuecomment-144483518","issue_url":"https://api.github.com/repos/laravel-doctrine/orm/issues/52","id":144483518,"user":{"login":"patrickbrouwers","id":7728097,"avatar_url":"https://avatars.githubusercontent.com/u/7728097?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickbrouwers","html_url":"https://github.com/patrickbrouwers","followers_url":"https://api.github.com/users/patrickbrouwers/followers","following_url":"https://api.github.com/users/patrickbrouwers/following{/other_user}","gists_url":"https://api.github.com/users/patrickbrouwers/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickbrouwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickbrouwers/subscriptions","organizations_url":"https://api.github.com/users/patrickbrouwers/orgs","repos_url":"https://api.github.com/users/patrickbrouwers/repos","events_url":"https://api.github.com/users/patrickbrouwers/events{/privacy}","received_events_url":"https://api.github.com/users/patrickbrouwers/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T17:27:58Z","updated_at":"2015-09-30T17:27:58Z","body":"Sorry, was confusing two people, haha :p"}}