【发布时间】:2016-02-03 08:36:55
【问题描述】:
我尝试使用单元测试,但它不起作用。不知何故,收到的状态码是 404。然后,终端说明原因是异常 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'。
Routes.php
Route::get('/', function() {
return view('toppage')->with('contents', "");
});
ExampleTest.php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testExample()
{
$this->visit('/')
->see('Where lane');
}
}
nignx.conf(从文件中摘录一部分)
location / {
index index.html index.php;
}
location ~* /MAMP(.*)$ {
root /Applications/MAMP/bin;
index index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
【问题讨论】:
标签: php unit-testing laravel laravel-5