Changeset 23569
- Timestamp:
- 11/03/09 15:02:40 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tools/lime/branches/2.0/lib/mock/LimeMockInvocationExpectation.php
r21377 r23569 56 56 $output = null, 57 57 $matchers = array(), 58 $returns = false, 58 59 $returnValue = null, 59 60 $exception = null, … … 144 145 if (!is_null($this->callback)) 145 146 { 146 return call_user_func_array($this->callback, $invocation->getParameters()); 147 $result = call_user_func_array($this->callback, $invocation->getParameters()); 148 149 return $this->returns ? $this->returnValue : $result; 147 150 } 148 151 … … 323 326 public function returns($value) 324 327 { 328 $this->returns = true; 325 329 $this->returnValue = $value; 326 330 tools/lime/branches/2.0/test/unit/mock/LimeMockTest.php
r23567 r23569 100 100 101 101 102 $t = new LimeTest(9 4);102 $t = new LimeTest(96); 103 103 104 104 … … 741 741 742 742 743 // @Test: If a callback AND a return value is configured, the return value of the callback is ignored 744 745 // test 746 $m->testMethod()->callback(array('TestCallbackClass', 'callback'))->returns('elvis sure is dead'); 747 $m->replay(); 748 $value = $m->testMethod(); 749 // assertions 750 $t->is($value, 'elvis sure is dead', 'The return value of the callback was ignored'); 751 752 753 // @Test: The return value of the callback is ignored even if the configured return value is NULL 754 755 // test 756 $m->testMethod()->callback(array('TestCallbackClass', 'callback'))->returns(null); 757 $m->replay(); 758 $value = $m->testMethod(); 759 // assertions 760 $t->same($value, null, 'The return value of the callback was ignored'); 761 762 743 763 // @Test: Parameters are passed to the callback correctly, if any parameters are expected 744 764