/** * {@inheritdoc} */ public function isThereProduct(ProductInterface $product) { if (!($table = $this->getDocument()->find('css', 'table'))) { return false; } $row = $this->tableAccessor->getRowWithFields($table, ['id' => $product->getId()]); return null === $row; }
/** * {@inheritdoc} */ public function isOrderWithNumberInTheList($number) { try { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('customer_orders'), ['number' => $number]); return 1 === count($rows); } catch (\InvalidArgumentException $exception) { return false; } }
/** * {@inheritdoc} */ public function hasItemWithProductAndQuantity($productName, $quantity) { $table = $this->getElement('items_table'); try { $this->tableAccessor->getRowWithFields($table, ['item' => $productName, 'qty' => $quantity]); } catch (\InvalidArgumentException $exception) { return false; } return true; }
/** * {@inheritdoc} */ public function isResourceOnPage(array $parameters) { try { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('table'), $parameters); return 1 === count($rows); } catch (\InvalidArgumentException $exception) { return false; } catch (ElementNotFoundException $exception) { return false; } }
/** * {@inheritdoc} */ public function isThereShippingMethodNamed($name) { if (null === ($table = $this->getDocument()->find('css', 'table'))) { return false; } try { $row = $this->tableAccessor->getRowWithFields($table, ['name' => $name]); } catch (\InvalidArgumentException $exception) { return false; } return 1 === $row; }
/** * {@inheritdoc} */ public function isSingleResourceWithSpecificElementOnPage(array $parameters, $element) { try { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('table'), $parameters); if (1 !== count($rows)) { return false; } return null !== $rows[0]->find('css', $element); } catch (\InvalidArgumentException $exception) { return false; } catch (ElementNotFoundException $exception) { return false; } }
/** * {@inheritdoc} */ public function isProductInTheList($name) { try { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('order_items'), ['item' => $name]); return 1 === count($rows); } catch (\InvalidArgumentException $exception) { return false; } }
/** * @param string $itemName * @param string $property * * @return string */ private function getItemProperty($itemName, $property) { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('table'), ['item' => $itemName]); return $rows[0]->find('css', '.' . $property)->getText(); }
/** * {@inheritdoc} */ public function countPaymentWithSpecificState($state) { $rows = $this->tableAccessor->getRowsWithFields($this->getElement('table'), ['state' => $state]); return count($rows); }
/** * {@inheritdoc} */ public function getNumberOfNewCustomersInTheList() { return $this->tableAccessor->countTableBodyRows($this->getElement('customer_list')); }
/** * {@inheritDoc} */ public function isItPossibleToChangePaymentMethodForOrder(OrderInterface $order) { $row = $this->tableAccessor->getRowWithFields($this->getElement('customer_orders'), ['number' => $order->getNumber()]); return $row->hasLink('Pay'); }
/** * {@inheritdoc} */ public function getUsedThemeName($channelCode) { $table = $this->getDocument()->find('css', 'table'); $row = $this->tableAccessor->getRowWithFields($table, ['code' => $channelCode]); return trim($this->tableAccessor->getFieldFromRow($table, $row, 'theme')->getText()); }