/** * {@inheritdoc} */ public function getOptionCode() { if (null === $this->option) { throw new \BadMethodCallException('The option have not been created yet so you cannot access proxy methods.'); } return $this->option->getCode(); }
/** * {@inheritdoc} */ public function addToCartWithOption(ProductOptionInterface $option, $optionValue) { $select = $this->getDocument()->find('css', sprintf('select#sylius_cart_item_variant_%s', $option->getCode())); $this->getDocument()->selectFieldOption($select->getAttribute('name'), $optionValue); $this->getDocument()->pressButton('Add to cart'); }
/** * @Then /^(this product option) should still be named "([^"]+)"$/ * @Then /^(this product option) name should be "([^"]+)"$/ */ public function thisProductOptionNameShouldStillBe(ProductOptionInterface $productOption, $productOptionName) { $this->iBrowseProductOptions(); Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $productOption->getCode(), 'name' => $productOptionName]), sprintf('Product option name %s has not been assigned properly.', $productOptionName)); }