Changeset 20954
- Timestamp:
- 08/09/09 12:38:45 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/branches/2.0-experimental/lib/mock/LimeMock.php
r20332 r20954 201 201 foreach ($class->getMethods() as $method) 202 202 { 203 if (!in_array($method->getName(), self::$illegalMethods)) 203 /* @var $method ReflectionMethod */ 204 if (!in_array($method->getName(), self::$illegalMethods) && !$method->isFinal()) 204 205 { 205 /* @var $method ReflectionMethod */206 206 $modifiers = Reflection::getModifierNames($method->getModifiers()); 207 207 $modifiers = array_diff($modifiers, array('abstract')); tools/lime/branches/2.0-experimental/test/unit/mock/LimeMockTest.php
r20496 r20954 53 53 } 54 54 55 class TestClassWithFinalMethods 56 { 57 public static $calls = 0; 58 59 public final function testMethod() 60 { 61 ++self::$calls; 62 } 63 } 64 55 65 class TestException extends Exception {} 56 66 57 67 58 $t = new LimeTest( 79);68 $t = new LimeTest(80); 59 69 60 70 … … 133 143 $t->is(TestClass::$calls, 0, 'The method has not been called'); 134 144 145 146 // @Test: Final methods cannot be mocked 147 148 // fixtures 149 TestClassWithFinalMethods::$calls = 0; 150 $m = LimeMock::create('TestClassWithFinalMethods'); 151 $m->replay(); 152 // test 153 $m->testMethod(); 154 // assertions 155 $t->is(TestClassWithFinalMethods::$calls, 1, 'The method has been called'); 135 156 136 157