예제 #1
0
 /**
  * Handle the message to retrieve the cached content from the injected cache proxy.
  * @param \Brickoo\Component\Messaging\Message $message
  * @return mixed the cached content otherwise null
  */
 public function handleRetrieveMessage(Message $message)
 {
     if ($message instanceof RetrieveMessage) {
         return $this->storageProxy->get($message->getIdentifier());
     }
     return null;
 }
예제 #2
0
 /**
  * @covers Brickoo\Component\Storage\StorageProxy::get
  * @covers Brickoo\Component\Storage\StorageProxy::getAdapter
  * @covers Brickoo\Component\Storage\StorageProxy::getReadyAdapter
  * @covers Brickoo\Component\Storage\StorageProxy::executeIterationCallback
  */
 public function testGetAdapterUsesFirstReadyAdapter()
 {
     $storageIdentifier = "someId";
     $storageContent = "some content";
     $adapterExpected = $this->getAdapterStub();
     $adapterExpected->expects($this->once())->method("get")->with($storageIdentifier)->will($this->returnValue($storageContent));
     $adapterUnexpected = $this->getAdapterStub();
     $storageProxy = new StorageProxy($this->getAdapterPoolIterator([$adapterExpected, $adapterUnexpected]));
     $this->assertEquals($storageContent, $storageProxy->get($storageIdentifier));
 }