public function testProxyFields() { $this->annotationManager->shouldReceive('getClassAnnotations')->andReturn(array()); $this->pageFactory->shouldReceive('createDecorator')->andReturn($this->createNullDecorator()); $decorator = m::mock($this->decoratorClass); $decorator->shouldReceive('decorate')->andReturnUsing(function (Property $property) { return $property->name == 'elementWithUse' ? 'OK' : null; }); $page = new $this->pageClass($this->pageFactory); $this->realFactory->initElements($page, $decorator); $this->assertEquals('OK', $page->elementWithUse); }