我對Laravel單元測試有點新。我需要通過調用相同的單元測試回購函數來獲得不同的輸出。Laravel單元測試兩次相同的函數和不同的輸出
到目前爲止,我的測試是這樣的:
public function testReportOffdayWorked()
{
$input = [
'from_date' => '2016/01/01',
'to_date' => '2016/01/03',
];
$webServiceRepositoryMock = Mockery::mock('App\Repositories\WebServiceRepository');
$webServiceRepositoryMock->shouldReceive('callGet')->twice()->andReturn($this->issues);
$this->app->instance('App\Repositories\WebServiceRepository', $webServiceRepositoryMock);
$this->call('post', '/reporting/portal/report-offdays', $input);
$this->assertResponseOk();
$this->assertTrue($this->response->original->getName() == "Reporting::report_offday_worked");
}
我想獲得兩個不同的輸出爲callGet
功能。
正是我想要這樣的事情與laravel Mock對象。無論如何感謝您的回答:) – Lasith