Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 路线::控制器单元测试问题Laravel_Unit Testing_Routing_Laravel_Laravel 4 - Fatal编程技术网

Unit testing 路线::控制器单元测试问题Laravel

Unit testing 路线::控制器单元测试问题Laravel,unit-testing,routing,laravel,laravel-4,Unit Testing,Routing,Laravel,Laravel 4,自从我修改了我的路由结构,我的单元测试就快疯了。。。以下是我的路线: Route::group( ['prefix' => 'api/v1'],function () { Route::group( array('before' => 'appauth'), function () { Route::get('ciao',function () { return Response::json(Success::instance(array())); }); Route::

自从我修改了我的路由结构,我的单元测试就快疯了。。。以下是我的路线:

Route::group( ['prefix' => 'api/v1'],function () {
 Route::group( array('before' => 'appauth'), function () {
 Route::get('ciao',function () {
   return Response::json(Success::instance(array()));
 });
Route::controller('appuserslogin','AppUsersLoginController');
etc.....
});
现在,如果我运行测试,我会得到以下错误:
调用undefined方法illumed\Routing\Router::anything()
错误所指的行是带有Route::controller等的行

如果我删除了线路Route::controller等。。一切都好

如果我尝试“测试”appuserslogin URL,请在浏览器中进行测试(即转到
http://websiteurl/api/v1/appuserslogin/login?appKey=APPK&username=USERNAME&password=PASS
)它可以工作。所以这不是一个路由问题。 请不要介意查询参数,因为它们将在以后被删除


你知道为什么会发生这种情况吗?

这件事最近发生在我身上,但这不是导致问题的真正原因。问题是我无意中用与控制器相同的名称命名了一个测试,而不是在类名的末尾附加“test”。(示例:我的测试名称是“LandingController”,而不是“LandingControllerTest”。)

注意到类名,修复了它,问题解决了