/**
  * This method is called by PageFactory on all properties to decide how to decorate the property.
  *
  * @param Property $property The property that may be decorated.
  *
  * @return IProxy
  */
 public function decorate(Property $property)
 {
     if (!$this->canDecorate($property)) {
         return null;
     }
     $locator = $this->locatorFactory->createLocator($property);
     return $locator != null ? $this->doDecorate($property, $locator) : null;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->property = m::mock('\\QATools\\QATools\\PageObject\\Property');
     $this->locator = m::mock($this->locatorClass);
     $this->locatorFactory = m::mock('\\QATools\\QATools\\PageObject\\ElementLocator\\IElementLocatorFactory');
     if ($this->getName() == 'testEmptyLocatorPreventsDecoration') {
         $this->locatorFactory->shouldReceive('createLocator');
     } else {
         $this->locatorFactory->shouldReceive('createLocator')->andReturn($this->locator);
     }
     $this->decorator = new $this->decoratorClass($this->locatorFactory, $this->pageFactory);
 }