【发布时间】:2014-04-19 09:26:13
【问题描述】:
请解释为什么 Laravel 4 的示例测试对我来说失败了。
我的“/”路由重定向到我的 routes.php 文件中的“登录”。
(哦,我已经 RTFMed 并搜索了几个网站、博客和 tuts。)
-sh-3.2$ phpunit
PHPUnit 4.0.7 by Sebastian Bergmann.
Configuration read from /home/dev/phpunit.xml
The Xdebug extension is not loaded. No code coverage will be generated.
F
Time: 83 ms, Memory: 13.50Mb
There was 1 failure:
1) ExampleTest::testBasicExample
Failed asserting that false is true.
/home/dev/app/tests/ExampleTest.php:14
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
-sh-3.2$
这是来自 ExampleTest.php 的代码
<?php
class ExampleTest extends TestCase {
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$crawler = $this->client->request('GET', '/');
$this->assertTrue($this->client->getResponse()->isOk());
}
}
【问题讨论】:
-
没有测试代码,很难判断
-
注意:将标题更改为重定向失败
标签: laravel-4 phpunit eloquent