droirqk4795
2015-07-16 15:27
浏览 50
已采纳

CakePHP 3:运行phpunit时无法插入灯具

I just baked some Fixtures and some TestCases and whenever I run vendor/bin/phpunit I get a version of the following error:

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

IException: Unable to insert fixtures for "App\Test\TestCase\Controller\ScreensControllerTest" test case. SQLSTATE[HY000] [2002] No such file or directory in [/Applications/MAMP/htdocs/myapp/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php, line 254]

The fixtures and tests were baked automatically using the bake tools. I checked that each item in the $fixtures property corresponds to a file in tests/Fixture/. If I comment out the $fixtures declaration in any of the test classes the error just moves to the next class. So it's not bad syntax in any specific fixture/test.

图片转代码服务由CSDN问答提供 功能建议

我刚刚发布了一些Fixtures和一些TestCases,每当我运行 vendor / bin / phpunit 我得到以下错误的版本:

  $ vendor / bin / phpunit 
 
PHPUnit 4.7.7 by Sebastian Bergmann和贡献者。
 
感知:无法插入灯具 “App \ Test \ TestCase \ Controller \ ScreensControllerTest”测试用例。  SQLSTATE [HY000] [2002]在[/Applications/MAMP/htdocs/myapp/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php,第254行]中没有这样的文件或目录
   
 
 

使用烘焙工具自动烘烤灯具和测试。 我检查了 $ fixtures 属性中的每个项目对应于 tests / Fixture / 中的文件。 如果我在任何测试类中注释掉 $ fixtures 声明,那么错误就会转移到下一个类。 所以在任何特定的灯具/测试中语法都不错。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douju2012 2015-07-16 20:46
    已采纳

    This error means that PHP is not able to connect to the database. If you are using a SQLite database, make sure the directory is writable and exists.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题