/** * Perform actual decoration. * * @param Property $property The property that may be decorated. * @param IElementLocator $locator Locator. * * @return IProxy|null */ protected function doDecorate(Property $property, IElementLocator $locator) { $proxy_class = $this->getProxyClass($property); if (!$proxy_class) { return null; } if ($this->_isBEMBlock($property) || $this->_isBEMElement($property)) { /* @var $annotations BEMAnnotation[] */ $annotations = $property->getAnnotationsFromPropertyOrClass('@bem'); $this->_assertAnnotationUsage($annotations, $locator); if (!$annotations[0] instanceof BEMAnnotation) { return null; } $name = $this->_isBEMBlock($property) ? $annotations[0]->block : $annotations[0]->element; /* @var $proxy IProxy */ $proxy = new $proxy_class($name, $locator, $this->pageFactory); $proxy->setClassName($property->getDataType()); return $proxy; } return parent::doDecorate($property, $locator); }
/** * Creates decorator instance. * * @param IElementLocatorFactory $locator_factory Locator factory. * @param IPageFactory $page_factory Page factory. */ public function __construct(IElementLocatorFactory $locator_factory, IPageFactory $page_factory) { parent::__construct($locator_factory, $page_factory); $this->elementToProxyMapping[$this->_typifiedElementCollection] = '\\QATools\\QATools\\HtmlElements\\Proxy\\TypifiedElementCollectionProxy'; $this->elementToProxyMapping[$this->_typifiedElementInterface] = '\\QATools\\QATools\\HtmlElements\\Proxy\\TypifiedElementProxy'; }