1 | <?php |
||
14 | class TemplateDataTest extends TestCase |
||
15 | { |
||
16 | /** |
||
17 | * @var \Netgen\Bundle\InformationCollectionBundle\Value\TemplateData |
||
18 | */ |
||
19 | protected $templateData; |
||
20 | |||
21 | /** |
||
22 | * @var \Netgen\Bundle\InformationCollectionBundle\Event\InformationCollected |
||
23 | */ |
||
24 | protected $event; |
||
25 | |||
26 | /** |
||
27 | * @var \eZ\Publish\Core\Repository\Values\Content\Content |
||
28 | */ |
||
29 | protected $content; |
||
30 | |||
31 | /** |
||
32 | * @var \Twig_TemplateWrapper |
||
33 | */ |
||
34 | protected $templateWrapper; |
||
35 | |||
36 | public function setUp() |
||
37 | { |
||
38 | $twig = new Twig_Environment( |
||
39 | new Twig_Loader_Array( |
||
40 | array( |
||
41 | 'index' => '{% block foo %}{% endblock %}', |
||
42 | ) |
||
43 | ) |
||
44 | ); |
||
45 | |||
46 | $this->event = new InformationCollected(new DataWrapper('test', null, null)); |
||
47 | $this->content = new Content(); |
||
48 | $this->templateWrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); |
||
49 | |||
50 | $this->templateData = new TemplateData( |
||
51 | array( |
||
52 | 'event' => $this->event, |
||
53 | 'content' => $this->content, |
||
54 | 'templateWrapper' => $this->templateWrapper, |
||
55 | ) |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | public function testGetters() |
||
65 | |||
66 | /** |
||
67 | * @expectedException \Netgen\Bundle\InformationCollectionBundle\Exception\PropertyNotFoundException |
||
68 | * @expectedExceptionMessage Property 'test' not found on class 'Netgen\Bundle\InformationCollectionBundle\Value\TemplateData' |
||
69 | */ |
||
70 | public function testExceptionShouldBeThrownInCaseOfAccessingNonExistingProperty() |
||
74 | |||
75 | /** |
||
76 | * @expectedException \Netgen\Bundle\InformationCollectionBundle\Exception\PropertyReadOnlyException |
||
77 | * @expectedExceptionMessage Property 'event' is readonly on class 'Netgen\Bundle\InformationCollectionBundle\Value\TemplateData' |
||
78 | */ |
||
79 | public function testExceptionShouldBeThrownInCaseOfSettingPropertyValue() |
||
83 | |||
84 | /** |
||
85 | * @expectedException \Netgen\Bundle\InformationCollectionBundle\Exception\PropertyNotFoundException |
||
86 | * @expectedExceptionMessage Property 'test' not found on class 'Netgen\Bundle\InformationCollectionBundle\Value\TemplateData' |
||
87 | */ |
||
88 | public function testExceptionShouldBeThrownInCaseOfSettingPropertyValueOfNonExistingProperty() |
||
92 | } |
||
93 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.