1 | <?php |
||
22 | class SearchTest extends \PHPUnit_Framework_TestCase |
||
23 | { |
||
24 | /** |
||
25 | * @expectedException InvalidArgumentException |
||
26 | */ |
||
27 | public function testSearchException() |
||
32 | |||
33 | /** |
||
34 | * @expectedException InvalidArgumentException |
||
35 | */ |
||
36 | public function testMaximumPriceException() |
||
41 | |||
42 | public function testMaximumPriceGetterAndSetter() |
||
51 | |||
52 | public function testMinimumPriceGetterAndSetter() |
||
61 | |||
62 | /** |
||
63 | * @expectedException InvalidArgumentException |
||
64 | */ |
||
65 | public function testMinimumPriceException() |
||
70 | |||
71 | public function testSearchValidPage() |
||
78 | |||
79 | public function testConditionGetterAndSetter() |
||
85 | |||
86 | public function testAvailabilityGetterAndSetter() |
||
92 | |||
93 | public function testNodeGetterAndSetter() |
||
100 | |||
101 | public function testGetCategory() |
||
102 | { |
||
103 | $search = new Search(); |
||
104 | static::assertEquals(null, $search->getCategory()); |
||
105 | $search->setCategory('All'); |
||
106 | static::assertEquals('All', $search->getCategory()); |
||
107 | } |
||
108 | |||
109 | public function testGetKeywords() |
||
110 | { |
||
111 | $search = new Search(); |
||
112 | static::assertEquals(null, $search->getKeywords()); |
||
113 | $search->setKeywords('4k tv'); |
||
114 | static::assertEquals('4k tv', $search->getKeywords()); |
||
115 | } |
||
116 | |||
117 | public function testGetPage() |
||
118 | { |
||
119 | $search = new Search(); |
||
120 | static::assertEquals(null, $search->getPage()); |
||
121 | $search->setPage(3); |
||
122 | static::assertEquals(3, $search->getPage()); |
||
123 | } |
||
124 | |||
125 | public function testGetMinimumPrice() |
||
126 | { |
||
127 | $search = new Search(); |
||
128 | static::assertEquals(null, $search->getMinimumPrice()); |
||
129 | $search->setMinimumPrice(899); |
||
130 | static::assertEquals(899, $search->getMinimumPrice()); |
||
131 | } |
||
132 | |||
133 | public function testGetMaximumPrice() |
||
134 | { |
||
135 | $search = new Search(); |
||
136 | static::assertEquals(null, $search->getMaximumPrice()); |
||
137 | $search->setMaximumPrice(899); |
||
138 | static::assertEquals(899, $search->getMaximumPrice()); |
||
139 | } |
||
140 | |||
141 | public function testGetCondition() |
||
142 | { |
||
143 | $search = new Search(); |
||
144 | static::assertEquals(null, $search->getCondition()); |
||
145 | $search->setCondition('Collectible'); |
||
146 | static::assertEquals('Collectible', $search->getCondition()); |
||
147 | } |
||
148 | |||
149 | public function testGetAvailability() |
||
150 | { |
||
151 | $search = new Search(); |
||
152 | static::assertEquals(null, $search->getAvailability()); |
||
153 | $search->setAvailability('Available'); |
||
154 | static::assertEquals('Available', $search->getAvailability()); |
||
155 | } |
||
156 | |||
157 | public function testGetBrowseNode() |
||
158 | { |
||
159 | $search = new Search(); |
||
160 | static::assertEquals(null, $search->getBrowseNode()); |
||
161 | $search->setBrowseNode(123); |
||
162 | static::assertEquals(123, $search->getBrowseNode()); |
||
163 | } |
||
164 | |||
165 | public function testGetCategory() |
||
171 | |||
172 | public function testGetKeywords() |
||
178 | |||
179 | public function testGetPage() |
||
185 | |||
186 | public function testGetMinimumPrice() |
||
192 | |||
193 | public function testGetMaximumPrice() |
||
199 | |||
200 | public function testGetCondition() |
||
206 | |||
207 | public function testGetAvailability() |
||
213 | |||
214 | public function testGetBrowseNode() |
||
220 | } |
||
221 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: