1 | <?php |
||
20 | class LuaAskResultProcessorTest extends \PHPUnit_Framework_TestCase { |
||
21 | |||
22 | /** |
||
23 | * Holds a mock of a query result for this test |
||
24 | * |
||
25 | * @var \SMWQueryResult |
||
26 | */ |
||
27 | private $queryResult; |
||
28 | |||
29 | /** |
||
30 | * Set-up method prepares a mock {@see \SMWQueryResult} |
||
31 | */ |
||
32 | protected function setUp() { |
||
49 | |||
50 | /** |
||
51 | * Test, if the constructor works |
||
52 | * |
||
53 | * @see \SMW\Scribunto\LuaAskResultProcessor::__construct |
||
54 | * |
||
55 | * @return void |
||
56 | */ |
||
57 | public function testCanConstruct() { |
||
66 | |||
67 | /** |
||
68 | * Tests the conversion of a {@see \SMWQueryResult} in a lua table |
||
69 | * |
||
70 | * @see \SMW\Scribunto\LuaAskResultProcessor::getProcessedResult |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | public function testGetProcessedResult() { |
||
90 | |||
91 | /** |
||
92 | * Tests the data extraction from a result row |
||
93 | * |
||
94 | * @see \SMW\Scribunto\LuaAskResultProcessor::getDataFromQueryResultRow |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | public function testGetDataFromQueryResultRow() { |
||
110 | |||
111 | /** |
||
112 | * Tests the retrieval of a key (string label or numeric index) from |
||
113 | * a print request |
||
114 | * |
||
115 | * @see \SMW\Scribunto\LuaAskResultProcessor::getKeyFromPrintRequest |
||
116 | * |
||
117 | * @return void |
||
118 | */ |
||
119 | public function testGetKeyFromPrintRequest() { |
||
163 | |||
164 | /** |
||
165 | * Tests the extraction of data from a SMWResultArray |
||
166 | * |
||
167 | * @see \SMW\Scribunto\LuaAskResultProcessor::getDataFromResultArray |
||
168 | * |
||
169 | * @return void |
||
170 | */ |
||
171 | public function testGetDataFromResultArray() { |
||
183 | |||
184 | /** |
||
185 | * Tests data value extraction. Uses data provider {@see dataProvidergetValueFromDataValueTest} |
||
186 | * @dataProvider dataProvidergetValueFromDataValueTest |
||
187 | * |
||
188 | * @param string $class name of data value class |
||
189 | * @param string $type data value type |
||
190 | * @param string $expects return value type |
||
191 | * |
||
192 | * @see \SMW\Scribunto\LuaAskResultProcessor::getValueFromDataValue |
||
193 | * |
||
194 | * @return void |
||
195 | */ |
||
196 | public function testGetValueFromDataValue( $class, $type, $expects ) { |
||
215 | |||
216 | /** |
||
217 | * Tests the conversion of a list of result values into a value, usable in lua. |
||
218 | * Uses data provider {@see dataProviderExtractLuaDataFromDVData} |
||
219 | * @dataProvider dataProviderExtractLuaDataFromDVData |
||
220 | * |
||
221 | * @param mixed $expects expected return value |
||
222 | * @param array $input input for method |
||
223 | * |
||
224 | * @see \SMW\Scribunto\LuaAskResultProcessor::extractLuaDataFromDVData |
||
225 | * |
||
226 | * @return void |
||
227 | */ |
||
228 | public function testExtractLuaDataFromDVData( $expects, $input ) { |
||
237 | |||
238 | /** |
||
239 | * Tests the generation of a numeric index key |
||
240 | * |
||
241 | * @see \SMW\Scribunto\LuaAskResultProcessor::getNumericIndex |
||
242 | * |
||
243 | * @return void |
||
244 | */ |
||
245 | public function testGetNumericIndex() { |
||
259 | |||
260 | /** |
||
261 | * Data provider for {@see testgetValueFromDataValue} |
||
262 | * |
||
263 | * @see testgetValueFromDataValue |
||
264 | * |
||
265 | * @return array |
||
266 | */ |
||
267 | public function dataProvidergetValueFromDataValueTest() { |
||
276 | |||
277 | /** |
||
278 | * Data provider for {@see testExtractLuaDataFromDVData} |
||
279 | * |
||
280 | * @see testExtractLuaDataFromDVData |
||
281 | * |
||
282 | * @return array |
||
283 | */ |
||
284 | public function dataProviderExtractLuaDataFromDVData() { |
||
291 | |||
292 | /** |
||
293 | * Constructs a mock {@see \SMWResultArray} |
||
294 | * |
||
295 | * @return \PHPUnit_Framework_MockObject_MockObject |
||
296 | */ |
||
297 | private function constructResultArray() { |
||
318 | |||
319 | /** |
||
320 | * Constructs a mock {@see \SMW\Query\PrintRequest} |
||
321 | * |
||
322 | * @return \PHPUnit_Framework_MockObject_MockObject |
||
323 | */ |
||
324 | private function constructPrintRequest() { |
||
332 | |||
333 | |||
334 | /** |
||
335 | * Constructs a mock {@see \SMWNumberValue} |
||
336 | * |
||
337 | * @return \PHPUnit_Framework_MockObject_MockObject |
||
338 | */ |
||
339 | private function constructSMWNumberValue() { |
||
347 | } |
||
348 |