Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP 3:运行phpunit时无法插入装置_Php_Unit Testing_Cakephp_Phpunit_Cakephp 3.0 - Fatal编程技术网

CakePHP 3:运行phpunit时无法插入装置

CakePHP 3:运行phpunit时无法插入装置,php,unit-testing,cakephp,phpunit,cakephp-3.0,Php,Unit Testing,Cakephp,Phpunit,Cakephp 3.0,我刚刚烘焙了一些装置和一些测试用例,每当我运行vendor/bin/phpunit时,我都会得到以下错误的版本: $ 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[HY

我刚刚烘焙了一些装置和一些测试用例,每当我运行
vendor/bin/phpunit
时,我都会得到以下错误的版本:

$ 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]

夹具和测试是使用烘焙工具自动烘焙的。我检查了
$fixtures
属性中的每个项目是否对应于
测试/Fixture/
中的一个文件。如果我注释掉任何测试类中的
$fixtures
声明,错误只会移动到下一个类。因此,在任何特定的fixture/test中,语法都不错。

此错误意味着PHP无法连接到数据库。如果您使用的是SQLite数据库,请确保该目录可写且存在。

是否可以尝试重新烘焙所有内容?尤其是sudopriveleges@UnstableEagle我已经重新调整了每个夹具和工作台测试,问题仍然存在。但是我没有用sudo。你认为这是权限问题吗?我认为这是一个好的开始。我认为问题可能是PHP无法访问其请求的文件夹/目录,因为Linux可能正在锁定PHPout@UnstableEagle我用
sudo
重新标记了Fixture,即使我用
sudo
Bingo运行phpunit,错误仍然保持不变。数据源配置有问题!