我有一个开箱即用的 Laravel 4 安装。我通过 XAMPP 使用 PHP 5.5、Apache 2.2 运行 Windows 8 64 位。
当我运行时,phpunit
我得到标准的 laravel 错误页面Whoops, looks like something went wrong.
,在它的正上方我看到PHPUnit 3.8-dev by Sebastian Bergmann. Configuration read from C:\project\phpunit.xml The Xdebug extension is not loaded. No code coverage will be generated.
如果我删除文件app/tests/ExampleTest.php
然后phpunit
似乎工作,我得到
PHPUnit 3.8-dev by Sebastian Bergmann.
Configuration read from C:\project\phpunit.xml
The Xdebug extension is not loaded. No code coverage will be generated.
Time: 232 ms, Memory: 2.75Mb
←[30;43mNo tests executed!←[0m
应用程序/测试/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());
}
}
应用程序/测试/TestCase.php
<?php
class TestCase extends Illuminate\Foundation\Testing\TestCase {
/**
* Creates the application.
*
* @return Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
return require __DIR__.'/../../bootstrap/start.php';
}
}