普通网友 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.

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

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?