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

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

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失