with() public method

public with ( Nelmio\Alice\Definition\MethodCallInterface $methodCall ) : self
$methodCall Nelmio\Alice\Definition\MethodCallInterface
return self
Beispiel #1
0
 public function testAddingACallCreatesANewBagWithTheAddedInstance()
 {
     $methodCall1 = new DummyMethodCall('mc1');
     $methodCall2 = new DummyMethodCall('mc2');
     $bag = new MethodCallBag();
     $bag1 = $bag->with($methodCall1);
     $bag2 = $bag1->with($methodCall2);
     $this->assertInstanceOf(MethodCallBag::class, $bag1);
     $this->assertNotSame($bag, $bag1);
     $this->assertSame([], $this->propRefl->getValue($bag));
     $this->assertSame([$methodCall1], $this->propRefl->getValue($bag1));
     $this->assertSame([$methodCall1, $methodCall2], $this->propRefl->getValue($bag2));
 }