php Shopware-Tests-Mink-Helper类(方法)实例源码

下面列出了php Shopware-Tests-Mink-Helper 类(方法)源码代码实例,从而了解它的用法。

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * @param array $data
  */
 public function unsubscribeNewsletter(array $data)
 {
     $mode = array(array('field' => 'subscribeToNewsletter', 'value' => -1));
     $data = array_merge($data, $mode);
     Helper::fillForm($this, 'newsletterForm', $data);
     Helper::pressNamedButton($this, 'newsletterFormSubmit');
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * @throws \Exception
  */
 private function pressShowResults()
 {
     $elements = Helper::findElements($this, ['filterShowResults']);
     /** @var NodeElement $showResults */
     $showResults = $elements['filterShowResults'];
     $showResults->press();
 }

作者:GerDne    项目:luck-docke   
/**
  * Fills the notification form and submits it
  * @param string $email
  */
 public function submitNotification($email)
 {
     $data = [['field' => 'sNotificationEmail', 'value' => $email]];
     Helper::fillForm($this, 'notificationForm', $data);
     $elements = Helper::findElements($this, ['notificationSubmit']);
     $elements['notificationSubmit']->press();
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * Returns the name
  * @param NodeElement $slide
  * @return string
  */
 public function getNameProperty(NodeElement $slide)
 {
     $selectors = Helper::getRequiredSelectors($this, ['slideImage', 'slideLink', 'slideName']);
     $nameElement = $slide->find('css', $selectors['slideName']);
     $names = ['imageAlt' => $slide->find('css', $selectors['slideImage'])->getAttribute('alt'), 'linkTitle' => $slide->find('css', $selectors['slideLink'])->getAttribute('title'), 'name' => $nameElement->getText(), 'nameTitle' => $nameElement->getAttribute('title')];
     return Helper::getUnique($names);
 }

作者:GerDne    项目:luck-docke   
/**
  * Changes the shipping method
  * @param array $data
  */
 public function changeShippingMethod(array $data = [])
 {
     $element = $this->getElement('CheckoutPayment');
     Helper::clickNamedLink($element, 'changeButton');
     Helper::fillForm($this, 'shippingPaymentForm', $data);
     Helper::pressNamedButton($this, 'changePaymentButton');
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * Returns the current payment method
  * @return string
  */
 public function getPaymentMethodProperty()
 {
     $element = Helper::findElements($this, ['currentMethod']);
     $currentMethod = $element['currentMethod']->getText();
     $currentMethod = str_word_count($currentMethod, 1);
     return $currentMethod[0];
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * Changes the shipping method
  * @param array $data
  */
 public function changeShippingMethod($data = array())
 {
     $element = $this->getElement('CheckoutPayment');
     $language = Helper::getCurrentLanguage($this);
     Helper::clickNamedLink($element, 'changeButton', $language);
     Helper::fillForm($this, 'shippingPaymentForm', $data);
     Helper::pressNamedButton($this, 'changePaymentButton');
 }

作者:GerDne    项目:luck-docke   
/**
  * @When /^I order the article on position (?P<position>\d+)$/
  */
 public function iOrderTheArticleOnPosition($position)
 {
     /** @var Listing $page */
     $page = $this->getPage('Listing');
     /** @var ArticleBox $articleBox */
     $articleBox = $this->getMultipleElement($page, 'ArticleBox', $position);
     Helper::clickNamedLink($articleBox, 'order');
 }

作者:GerDne    项目:luck-docke   
/**
  * @Given /^I click to read the blog article on position (\d+)$/
  */
 public function iClickToReadTheBlogArticleOnPosition($position)
 {
     /** @var Blog $page */
     $page = $this->getPage('Blog');
     /** @var BlogBox $blogBox */
     $blogBox = $this->getMultipleElement($page, 'BlogBox', $position);
     Helper::clickNamedLink($blogBox, 'readMore');
 }

作者:GerDne    项目:luck-docke   
private function clickActionLink($position, $name)
 {
     /** @var Note $page */
     $page = $this->getPage('Note');
     /** @var NotePosition $notePosition */
     $notePosition = $this->getMultipleElement($page, 'NotePosition', $position);
     Helper::clickNamedLink($notePosition, $name);
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * Fills the notification form and submits it
  * @param string $email
  */
 public function submitNotification($email)
 {
     $data = array(array('field' => 'sNotificationEmail', 'value' => $email));
     Helper::fillForm($this, 'notificationForm', $data);
     $locators = array('notificationSubmit');
     $elements = Helper::findElements($this, $locators);
     $elements['notificationSubmit']->press();
 }

作者:GerDne    项目:luck-docke   
/**
  * Proceeds to the confirmation page with login
  * @param string $eMail
  * @param string $password
  */
 public function proceedToOrderConfirmationWithLogin($eMail, $password)
 {
     if ($this->verifyPage()) {
         Helper::clickNamedLink($this, 'checkout');
     }
     $this->getPage('Account')->login($eMail, $password);
     $this->getPage('CheckoutConfirm')->verifyPage();
 }

作者:GerDne    项目:luck-docke   
/**
  * Changes the currency
  * @param string $currency
  * @throws \Behat\Mink\Exception\ElementNotFoundException
  */
 public function changeCurrency($currency)
 {
     if (!$this->getDriver() instanceof Selenium2Driver) {
         Helper::throwException('Changing the currency in Responsive template requires Javascript!');
     }
     $valid = ['EUR' => '€ EUR', 'USD' => '$ USD'];
     $this->selectFieldOption('__currency', $valid[$currency]);
 }

作者:GerDne    项目:luck-docke   
/**
  * Submits the filters
  * @throws \Exception
  */
 private function pressShowResults()
 {
     $this->getSession()->wait(5000, "\$('.filter--btn-apply:not(.is--loading):not([disabled=disabled])').length > 0");
     $elements = Helper::findElements($this, ['filterShowResults']);
     /** @var NodeElement $showResults */
     $showResults = $elements['filterShowResults'];
     $showResults->press();
 }

作者:GerDne    项目:luck-docke   
/**
  * @param array $locators
  * @return array
  */
 public function getProperties(array $locators)
 {
     $return = array();
     $elements = Helper::findElements($this, $locators);
     foreach ($elements as $locator => $element) {
         $funcName = 'get' . ucfirst($locator);
         $return[$locator] = $this->{$funcName}($element);
     }
     return $return;
 }

作者:GerDne    项目:luck-docke   
/**
  * @param string $propertyName
  * @return bool
  */
 public function setProperty($propertyName)
 {
     $elements = Helper::findElements($this, ['properties']);
     /** @var NodeElement $propertyContainer */
     $propertyContainer = $elements['properties'];
     if (!$propertyContainer->hasLink($propertyName)) {
         return false;
     }
     $propertyContainer->clickLink($propertyName);
     return true;
 }

作者:GerDne    项目:luck-docke   
/**
  * @inheritdoc
  */
 protected function checkRating(BlogComment $blogComments, $average)
 {
     $elements = Helper::findElements($this, ['articleRating', 'articleRatingCount']);
     $check = ['articleRating' => [$elements['articleRating']->getAttribute('content'), $average], 'articleRatingCount' => [$elements['articleRatingCount']->getText(), count($blogComments)]];
     $check = Helper::floatArray($check);
     $result = Helper::checkArray($check);
     if ($result !== true) {
         $message = sprintf('There was a different value of the rating! (%s: "%s" instead of "%s")', $result, $check[$result][0], $check[$result][1]);
         Helper::throwException($message);
     }
 }

作者:BucherStoerzbachGb    项目:shopwar   
/**
  * Helper function returns the data of an order position
  * @param NodeElement $position
  * @param string[] $selectors
  * @return array
  */
 private function getOrderPositionData(NodeElement $position, array $selectors)
 {
     $data = [];
     foreach ($selectors as $key => $selector) {
         $element = $position->find('css', $selector);
         $data[$key] = $element->getText();
         if ($key !== 'product') {
             $data[$key] = Helper::floatValue($data[$key]);
         }
     }
     return $data;
 }

作者:BucherStoerzbachGb    项目:shopwar   
public function checkCaptcha()
 {
     $locators = array('captchaPlaceholder', 'captchaImage', 'captchaHidden');
     $element = Helper::findElements($this, $locators);
     $captchaPlaceholder = $element['captchaPlaceholder']->getAttribute('data-src');
     $captchaImage = $element['captchaImage']->getAttribute('src');
     $captchaHidden = $element['captchaHidden']->getValue();
     if ($captchaPlaceholder !== '/shopware/widgets/Captcha/refreshCaptcha' || strpos($captchaImage, 'data:image/png;base64') === false || empty($captchaHidden)) {
         $message = 'There is no capture in this form!';
         Helper::throwException($message);
     }
 }

作者:GerDne    项目:luck-docke   
/**
  * @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);
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号