/** * Opens the listing page * @param array $params * @param bool $autoPage */ public function openListing(array $params, $autoPage = true) { $parameters = array_merge(['sCategory' => 3], $autoPage ? ['sPage' => 1] : [], Helper::convertTableHashToArray($params, 'parameter')); $categoryId = array_shift($parameters); $this->path = $this->basePath . '?' . http_build_query($parameters); $parameters['sCategory'] = $categoryId; $this->open($parameters); }
/** * @Then /^the article on position (?P<num>\d+) should have this properties:$/ */ public function theArticleOnPositionShouldHaveThisProperties($position, TableNode $properties) { /** @var Listing $page */ $page = $this->getPage('Listing'); /** @var ArticleBox $articleBox */ $articleBox = $this->getMultipleElement($page, 'ArticleBox', $position); $properties = Helper::convertTableHashToArray($properties->getHash()); $page->checkArticleBox($articleBox, $properties); }
/** * Checks an emotion article element * @param Article $article * @param array $data */ public function checkArticle(Article $article, array $data) { $properties = Helper::convertTableHashToArray($data); $properties = Helper::floatArray($properties, ['price']); $result = Helper::assertElementProperties($article, $properties); if ($result === true) { return; } $message = sprintf('The article %s is "%s" (should be "%s")', $result['key'], $result['value'], $result['value2']); Helper::throwException($message); }