Created
July 15, 2019 08:39
-
-
Save qt91/7b898b6465b93d7a176187a9b35e2731 to your computer and use it in GitHub Desktop.
Mock 2 function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->mock(SampleRepository::class, function (MockInterface $mock) { | |
$mock->shouldReceive('whereArray->save')->andReturnFalse();//Thang khon nang nay nam duoi, nhung phai duoc mock o tren | |
$mock->shouldReceive('whereArray')->andReturn(SampleModel::first());//Thang nay chay truoc, nhung lai goi sau | |
}); | |
//Unit test la 1 chuoi su khon nan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment