Created
August 16, 2012 09:34
-
-
Save guiled/3368798 to your computer and use it in GitHub Desktop.
Atoum, test if a mocked method is called only once
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->assert | |
->if($mock = new \mock\MyClassToMock()) | |
->if($test = myTestedClass($mock)) | |
->and($myCounter = 0) | |
->and($mock->getMockController()->mockedMethod = function () use(&$myCounter) {doWhatever();$myCounter++;}) | |
->and($test->myMethodThatUsesMockedMethod()) | |
->number($myCounter) | |
->isEqualTo(1); |
jubianchi
commented
Aug 16, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment