普通网友 2017-01-10 00:15
浏览 180
已采纳

Laravel Homestead中的PHPUnit测试失败

I have a fresh clone of laravel/framework:master running on a Homestead VM (on Mac host). I installed the dependencies (composer install - also composer update). When I run the tests I get

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.

Am I missing something?


Update

I answered my own question with the workarounds I found for these problems, although I don't fully understand them. Particularly I don't know if these issues were somehow special to my setup or instead are common and to be expected, in which case I wonder why the default Homestead configuration doesn't address them.

I'm leaving the question open for a while, in case anyone wants to explain or comment.

  • 写回答

1条回答 默认 最新

  • dqmq0654 2017-01-23 18:22
    关注

    I found that there was an exception being thrown on dns_get_record (called in active_url validation). Thanks to this issue I learnt that setting the natdnshostresolver option to "off" could solve it for me.

    On the first failing test, after chmod 000 a file, the assertion expected the file not to be readable. But it always stayed readable. It then occurred to me that I was doing the tests on a folder which was synced on the host machine. (Maybe it can't remove the read permission there?). I tried again from a non-synced folder and the test passed.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料