Development

Changeset 22547

You must first sign up to be able to contribute.

Changeset 22547

Show
Ignore:
Timestamp:
09/28/09 16:29:08 (4 years ago)
Author:
bschussek
Message:

Fixed: Methods with parameters passed by reference can be mocked

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/lime/branches/2.0/lib/mock/LimeMock.php

    r21377 r22547  
    197197          $name = '$'.$parameter->getName(); 
    198198 
     199          if ($parameter->isPassedByReference()) 
     200          { 
     201            $name = '&'.$name; 
     202          } 
     203 
    199204          if ($parameter->isOptional()) 
    200205          { 
  • tools/lime/branches/2.0/test/unit/mock/LimeMockTest.php

    r21375 r22547  
    3030} 
    3131 
     32interface TestInterfaceWithReferenceParameters 
     33{ 
     34  public function testMethod(&$parameter); 
     35} 
     36 
    3237abstract class TestClassAbstract 
    3338{ 
     
    8388 
    8489 
    85 $t = new LimeTest(92); 
     90$t = new LimeTest(93); 
    8691 
    8792 
     
    138143  // assertions 
    139144  $t->ok($m instanceof TestInterfaceWithTypeHints, 'The mock implements the interface'); 
     145 
     146 
     147// @Test: Methods with reference parameters can be mocked 
     148 
     149  // test 
     150  $m = LimeMock::create('TestInterfaceWithReferenceParameters', $output); 
     151  // assertions 
     152  $t->ok($m instanceof TestInterfaceWithReferenceParameters, 'The mock implements the interface'); 
    140153 
    141154