Exemplo n.º 1
0
 /**
  * @param NotePosition $notePositions
  * @param array $items
  */
 public function checkNoteProducts(NotePosition $notePositions, array $items)
 {
     Helper::assertElementCount($notePositions, count($items));
     $result = Helper::searchElements($items, $notePositions);
     if ($result !== true) {
         $messages = ['The following articles were not found:'];
         foreach ($result as $product) {
             $messages[] = $product['number'] . ' - ' . $product['name'];
         }
         Helper::throwException($messages);
     }
 }
Exemplo n.º 2
0
 /**
  * @param NotePosition $notePositions
  * @param array $items
  */
 public function checkNoteProducts(NotePosition $notePositions, array $items)
 {
     if (count($notePositions) !== count($items)) {
         $message = sprintf('There are %d products on the note! (should be %d)', count($notePositions), count($items));
         Helper::throwException($message);
     }
     $result = Helper::searchElements($items, $notePositions);
     if ($result !== true) {
         $messages = array('The following articles were not found:');
         foreach ($result as $product) {
             $messages[] = $product['number'] . ' - ' . $product['name'];
         }
         Helper::throwException($messages);
     }
 }
Exemplo n.º 3
0
 /**
  * Checks the product comparison
  * Available properties are: image, name, ranking, description, price, link
  *
  * @param CompareColumn $compareColumns
  * @param array $items
  */
 public function checkComparisonProducts(CompareColumn $compareColumns, array $items)
 {
     if (count($compareColumns) !== count($items)) {
         $message = sprintf('There are %d products in the comparison! (should be %d)', count($compareColumns), count($items));
         Helper::throwException($message);
     }
     $result = Helper::searchElements($items, $compareColumns);
     if ($result !== true) {
         $messages = array('The following articles were not found:');
         foreach ($result as $product) {
             $messages[] = $product['name'];
         }
         Helper::throwException($messages);
     }
 }
Exemplo n.º 4
0
 /**
  * Checks the product comparison
  * Available properties are: image, name, ranking, description, price, link
  *
  * @param CompareColumn $compareColumns
  * @param array $items
  */
 public function checkComparisonProducts(CompareColumn $compareColumns, array $items)
 {
     Helper::assertElementCount($compareColumns, count($items));
     $result = Helper::searchElements($items, $compareColumns);
     if ($result !== true) {
         $messages = ['The following articles were not found:'];
         foreach ($result as $product) {
             $messages[] = $product['name'];
         }
         Helper::throwException($messages);
     }
 }