Created
October 19, 2010 16:20
-
-
Save johnkary/634490 to your computer and use it in GitHub Desktop.
Using PHPUnit 3.5 MockBuilder to create a mock concrete object of an abstract class
This file contains 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
<?php | |
//Create mock BaseCredential called 'MockAdminCredential' whose 'calculate' | |
//function will always return true. All other methods will return NULL | |
//as per the default behavior of a stub. | |
$this->mockAdminCredential = $this->getMockBuilder('BaseCredential') | |
->setMockClassName('MockAdminCredential') | |
->setMethods(array('calculate')) | |
->getMock() | |
->expects($this->any()) | |
->method('calculate') | |
->will($this->returnValue(true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment