/** * Match the opened page to a category * * @param \XLite\Model\Category $category Category * * @return void * @access protected * @since 1.0.0 */ protected function doCategoryPageTesting(\XLite\Model\Category $category) { // Title $titleSelector = "h1#page-title.title"; if ($category->getShowTitle()) { $this->assertElementPresent("css={$titleSelector}", "A category title is missing (" . $category->getCategoryId() . ")"); $title = $this->getJSExpression("jQuery('{$titleSelector}').html()"); $this->assertEquals($category->getName(), $title, "A category displays a wrong title (" . $category->getCategoryId() . ")"); } else { $this->assertElementNotPresent("css={$titleSelector}", "A category title is exists (" . $category->getCategoryId() . ")"); } // Description $method = $category->getDescription() ? "assertElementPresent" : "assertElementNotPresent"; $this->{$method}("css=.category-description", "Wrong category description ({$method}, " . $category->getCategoryId() . ")"); }
/** * Prepare subnodes for the location path node * * @param \XLite\Model\Category $category Node category * * @return array */ protected function getLocationNodeSubnodes(\XLite\Model\Category $category) { $nodes = array(); foreach ($category->getSiblings(true) as $category) { $nodes[] = \XLite\View\Location\Node::create($category->getName(), $this->getCategoryURL($category)); } return $nodes; }
/** * The method is used as a callback in the "$this->getCategoryNamePath()" method * * @param \XLite\Model\Category $category Category * * @return string */ public function getCategoryName(\XLite\Model\Category $category) { return $category->getName(); }
/** * {@inheritDoc} */ public function getName() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', array()); return parent::getName(); }