我的symfony app运行得很好......我相信使用PDO驱动程序(虽然我不确定如何验证)。
我见过一个stackoverflow问题,结果是那个人正在运行Laravel并且它试图使用sqlite。我不相信这是个案,但我不知道如何检查。
然而,当我运行phpunit时,我得到了这个回复:
There was 1 error:
1) Tests\AppBundle\Controller\DefaultControllerTest::testIndex
Doctrine\DBAL\Exception\DriverException: An exception occured in driver: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:41
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2506
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:3570
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:3603
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php:65
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php:95
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php:58
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php:50
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:230
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:79
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
Caused by
Doctrine\DBAL\Driver\PDOException: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:41
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2506
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:3570
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:3603
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php:65
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php:95
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/TraceableControllerResolver.php:58
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php:50
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:230
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:79
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
Caused by
PDOException: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:145
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:47
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2577
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:74
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php:61
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
Caused by
Doctrine\DBAL\Exception\DriverException: An exception occured in driver: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:115
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:41
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2577
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:74
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php:61
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
Caused by
Doctrine\DBAL\Driver\PDOException: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:47
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:41
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2577
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:74
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php:61
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
Caused by
PDOException: could not find driver
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:41
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:389
/var/www/sitename.com/public_html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:328
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:763
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/var/www/sitename.com/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:216
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:281
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php:44
/var/www/sitename.com/public_html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:698
/var/www/sitename.com/public_html/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php:51
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:1826
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4028
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:4115
/var/www/sitename.com/public_html/var/cache/test/appTestDebugProjectContainer.php:2577
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:310
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:74
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Security/FirewallMap.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php:61
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php:106
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:174
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:43
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:129
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:168
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php:62
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Client.php:131
/var/www/sitename.com/public_html/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php:315
/var/www/sitename.com/public_html/tests/AppBundle/Controller/DefaultControllerTest.php:13
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
非常感谢任何人都可以提供的任何见解!感谢
更新:这是测试代码:
namespace Tests\AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertContains('TEST TEXT', $crawler->filter('#homepage .jumbotron')->text());
}
}
更新:这是我的phpunit.xml.dist
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="app/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
<exclude>
<directory>src/*Bundle/Resources</directory>
<directory>src/*/*Bundle/Resources</directory>
<directory>src/*/Bundle/*Bundle/Resources</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
这是我的autoload.php
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
return $loader;
这是vendor / autoload.php
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit2554ac6f5d571f82debebd2d3d7133d2::getLoader();
答案 0 :(得分:2)
正如日志所说,它正在尝试使用PDL_Mysql驱动程序连接到数据库。如果网站在运行Apache / mod_php或PHP-FPM时工作,那么运行网站的PHP版本与用于运行PHPUnit的CLI sapi之间的配置不同。比较phpinfo()
和php -m
中显示的PHP模块列表,它将显示命令行'cli'服务器API可用的模块。