Laravel Homestead 中的 PHPUnit 测试失败
Failing PHPUnit tests in Laravel Homestead
我在 Homestead VM(在 Mac 主机上)上有一个新的 laravel/framework:master
运行ning 克隆。我安装了依赖项(composer install
- 也 composer update
)。当我 运行 测试时,我得到
There were 2 failures:
1) FilesystemTest::testIsReadable Failed asserting that true is false.
/home/vagrant/Code/project/vendor/laravel/framework/tests/Filesystem/FilesystemTest.php:305
2) ValidationValidatorTest::testValidateActiveUrl Failed asserting that false is true.
/home/vagrant/Code/project/vendor/laravel/framework/tests/Validation/ValidationValidatorTest.php:1825
$ php -v
PHP 7.1.0-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.1.0-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
with blackfire v1.14.1~linux-x64-non_zts71, https://blackfire.io, by Blackfireio Inc.
$ phpunit --version
PHPUnit 5.7.5 by Sebastian Bergmann and contributors.
我是不是漏掉了什么?
更新
我用我为这些问题找到的解决方法回答了我自己的问题,尽管我并不完全理解它们。特别是我不知道这些问题是否对我的设置有某种特殊性,或者相反是常见的并且是预料之中的,在这种情况下,我想知道为什么默认的 Homestead 配置没有解决这些问题。
我暂时搁置这个问题,以防有人想解释或发表评论。
我发现在 dns_get_record
上抛出了异常(在 active_url
验证中调用)。感谢 this issue,我了解到将 natdnshostresolver
选项设置为 "off" 可以为我解决这个问题。
在第一个失败的测试中,在 chmod 000
个文件之后,断言预计该文件不可读。但它始终保持可读性。然后我想到我正在对主机上同步的文件夹进行测试。 (也许它不能在那里删除读取权限?)。我从 non-synced 文件夹再次尝试,测试通过。
我在 Homestead VM(在 Mac 主机上)上有一个新的 laravel/framework:master
运行ning 克隆。我安装了依赖项(composer install
- 也 composer update
)。当我 运行 测试时,我得到
There were 2 failures: 1) FilesystemTest::testIsReadable Failed asserting that true is false. /home/vagrant/Code/project/vendor/laravel/framework/tests/Filesystem/FilesystemTest.php:305 2) ValidationValidatorTest::testValidateActiveUrl Failed asserting that false is true. /home/vagrant/Code/project/vendor/laravel/framework/tests/Validation/ValidationValidatorTest.php:1825
$ php -v PHP 7.1.0-2+deb.sury.org~xenial+1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.1.0-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies with blackfire v1.14.1~linux-x64-non_zts71, https://blackfire.io, by Blackfireio Inc. $ phpunit --version PHPUnit 5.7.5 by Sebastian Bergmann and contributors.
我是不是漏掉了什么?
更新
我用我为这些问题找到的解决方法回答了我自己的问题,尽管我并不完全理解它们。特别是我不知道这些问题是否对我的设置有某种特殊性,或者相反是常见的并且是预料之中的,在这种情况下,我想知道为什么默认的 Homestead 配置没有解决这些问题。
我暂时搁置这个问题,以防有人想解释或发表评论。
我发现在 dns_get_record
上抛出了异常(在 active_url
验证中调用)。感谢 this issue,我了解到将 natdnshostresolver
选项设置为 "off" 可以为我解决这个问题。
在第一个失败的测试中,在 chmod 000
个文件之后,断言预计该文件不可读。但它始终保持可读性。然后我想到我正在对主机上同步的文件夹进行测试。 (也许它不能在那里删除读取权限?)。我从 non-synced 文件夹再次尝试,测试通过。