Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class AbstractClass
- {
- public function concreteMethod()
- {
- return $this->abstractMethod();
- }
- public abstract function abstractMethod();
- }
- class AbstractClassTest extends PHPUnit_Framework_TestCase
- {
- public function testConcreteMethod()
- {
- $stub = $this->getMockForAbstractClass('AbstractClass');
- $stub->expects($this->any())
- ->method('abstractMethod')
- ->will($this->returnValue(TRUE));
- $this->assertTrue($stub->concreteMethod());
- }
- }
- protected function setUp()
- {
- $stub = $this->getMockForAbstractClass('Some_Abstract_Class');
- $this->_object = $stub;
- }
- sudo pear channel-update pear.phpunit.de
- sudo pear upgrade phpunit/PHPUnit
- class AbstractClassTest extends PHPUnit_Framework_TestCase
- {
- /**
- * @var AbstractClass
- */
- private $testedClass;
- public function setUp()
- {
- $this->testedClass = new class extends AbstractClass {
- protected function abstractMethod()
- {
- // Put a barebones implementation here
- }
- };
- }
- // Put your tests here
- }
Add Comment
Please, Sign In to add comment