Example #1
0
 /**
  *
  */
 public function testReturnsKeyValueWhenAllContainedArrayAccessObjectsHaveThisKeyValuePair2()
 {
     $composite = new Composite();
     $keyValue1 = new \ArrayIterator();
     $composite->attach($keyValue1);
     $keyValue2 = new \ArrayIterator();
     $composite->attach($keyValue2);
     $key = 'Key';
     $value = 'Value';
     $composite[$key] = $value;
     $this->assertEquals($value, $composite[$key]);
 }
 /**
  *
  */
 public function testCallsAllAttachedCallbacksWhenInvoked()
 {
     $composite = new Composite();
     $parameter = new \stdClass();
     $callbackAttached1 = $this->createCallbackMock($this->once(), $parameter);
     $composite->attach($callbackAttached1);
     $callbackNotAttached1 = $this->createCallbackMock($this->never());
     $composite->attach($callbackNotAttached1);
     $callbackAttached2 = $this->createCallbackMock($this->once(), $parameter);
     $composite->attach($callbackAttached2);
     $callbackNotAttached2 = $this->createCallbackMock($this->never());
     $composite->attach($callbackNotAttached2);
     $composite->detach($callbackNotAttached1);
     $composite->detach($callbackNotAttached2);
     $composite($parameter);
 }