function it_find_previous_and_next_products($productManager, SequentialEdit $sequentialEdit, ProductInterface $product, ProductInterface $previous, ProductInterface $next)
 {
     $sequentialEdit->getObjectSet()->willReturn([1, 6, 5, 2]);
     $sequentialEdit->countObjectSet()->willReturn(4);
     $product->getId()->willReturn(5);
     $productManager->find(6)->willReturn($previous);
     $productManager->find(2)->willReturn($next);
     $sequentialEdit->setCurrent($product)->shouldBeCalled();
     $sequentialEdit->setPrevious($previous)->shouldBeCalled();
     $sequentialEdit->setNext($next)->shouldBeCalled();
     $this->findWrap($sequentialEdit, $product);
 }
 /**
  * {@inheritDoc}
  */
 public function getNextId($productId)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getNextId', array($productId));
     return parent::getNextId($productId);
 }
 /**
  * Find previous sequential edit entity
  *
  * @param SequentialEdit $sequentialEdit
  * @param int            $currentKey
  *
  * @return null|ProductInterface
  */
 protected function findPrevious(SequentialEdit $sequentialEdit, $currentKey)
 {
     $previous = null;
     $objectSet = $sequentialEdit->getObjectSet();
     while ($currentKey-- > 0 && null === $previous) {
         $previous = $this->productManager->find($objectSet[$currentKey]);
     }
     return $previous;
 }
 /**
  * Find previous sequential edit entity
  *
  * @param SequentialEdit $sequentialEdit
  * @param int            $currentKey
  *
  * @return null|ProductInterface
  */
 protected function findPrevious(SequentialEdit $sequentialEdit, $currentKey)
 {
     $previous = null;
     $objectSet = $sequentialEdit->getObjectSet();
     while ($currentKey-- > 0 && null === $previous) {
         $previous = $this->productRepository->findOneByWithValues($objectSet[$currentKey]);
     }
     return $previous;
 }
 function it_normalize_sequential_edits(SequentialEdit $sequentialEdit)
 {
     $sequentialEdit->getObjectSet()->willReturn(['objectSet']);
     $this->normalize($sequentialEdit)->shouldReturn(['objectSet' => ['objectSet']]);
 }