Exemplo n.º 1
0
 /**
  * Execute a callback on every ready adapter.
  * @param \Closure $callbackFunction
  * @return \Brickoo\Component\Storage\StorageProxy
  */
 private function executeIterationCallback(\Closure $callbackFunction)
 {
     $this->rewindAdapterPool();
     $callbackValue = null;
     while ($callbackValue !== self::BREAK_ITERATION_CALLBACK && $this->adapterPoolIterator->valid() && $this->adapterPoolIterator->isCurrentReady()) {
         $callbackValue = $callbackFunction($this->adapterPoolIterator->current());
         $this->adapterPoolIterator->next();
     }
     return $this;
 }
 /**
  * @covers Brickoo\Component\Storage\Adapter\AdapterPoolIterator::isCurrentReady
  * @covers Brickoo\Component\Storage\Adapter\AdapterPoolIterator::isEmpty
  * @covers Brickoo\Component\Storage\Adapter\Exception\PoolIsEmptyException
  * @expectedException \Brickoo\Component\Storage\Adapter\Exception\PoolIsEmptyException
  */
 public function testIsCurrentReadyThrowsExceptionIfPoolIsEmpty()
 {
     $adapterPoolIterator = new AdapterPoolIterator([]);
     $adapterPoolIterator->isCurrentReady();
 }