当我尝试运行phpunit时出现以下错误。
PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /Users/user/Development/Web/ProjectFlyer/vendor/laravel/framework/src/Illuminate/Database/ConnectionInterface.php on line 3
我有一个测试:
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class FlyersControllerTest extends TestCase
{
/** @test */
public function it_shows_the_form_to_create_a_new_flyer()
{
$this->visit('/flyers/create');
}
}
我的路线文件包含:
Route::get('{zip}/{street}', 'FlyersController@show');
Route::resource('flyers', 'FlyersController');
这应该会产生一个失败的测试,因为show route正在覆盖create for resource。相反,它给了我最大的函数嵌套级错误。
如果我修复路由问题,并运行phpunit,我会得到:
OK (1 test, 1 assertion)