0
我有一個將請求轉發到另一個控制器的場景的API。測試路線調度
即:
$request = Request::create'/new/resource', 'POST');
Route::dispatch($request);
我怎麼會寫一個測試,以驗證這種調度發生,因爲我期待? (我知道我不應該嘲笑「請求」門面)
即:
class MyTest extends TestCase {
public function myTestShouldForwardRequestCorrectly()
{
// Once for initial request, and once for fwd request?
// Maybe also test w/ mockery spy which resource the Request is going to?
$m = Route::shouldReceive('dispatch')->times(2);
.... setup test ...
$this->call('POST', '/initial/resource', $parameters);
}
}