2016-07-22 106 views
0

我有一组API:与组前缀Laravel测试

Route::group(array('prefix' => 'api'), function() { 

    Route::get('abc', function() { 
     return 'abc'; 
    }); 
); 

但是,测试使用$this->call('GET', '/api/abc)$this->call('GET', 'path_to_abc')的时候,我总是得到404错误,虽然我打印的网址,我可以访问该链接在浏览器

+0

其他路线是否在你的测试用例文件中工作? –

+0

不,我刚刚写了1个基本测试 – maphongba008

回答

0

如果您还没有配置您的TestCase.php文件,你需要在那里设置你的应用程序网址为

文件:TestCase.php

/** 
* The base URL to use while testing the application. 
* 
* @var string 
*/ 
protected $baseUrl = 'http://YOUR_APP_URL'; 
+0

不工作。我使用绝对路径,如:http://localhost/.../abc但仍然出错 – maphongba008