blob: 574faeb20707fe20b8a218f68fdf8e02f2aa938f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<?php
namespace SMW\Test;
/**
* Base class for SMW\ResultPrinter tests.
*
* @group SMW
* @group SMWExtension
*
* @codeCoverageIgnore
*
* @license GNU GPL v2+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
abstract class QueryPrinterRegistryTestCase extends QueryPrinterTestCase {
/**
* Returns the names of the formats supported by the
* \SMW\ResultPrinter being tested.
*
* @since 1.8
*
* @return array
*/
public abstract function getFormats();
/**
* @since 1.8
*
* @return array
*/
public function constructorProvider() {
$argumentLists = [];
foreach ( $this->getFormats() as $format ) {
$argumentLists[] = [ $format, true ];
$argumentLists[] = [ $format, false ];
}
return $argumentLists;
}
/**
* Creates and returns a new instance of the result printer.
*
* @since 1.8
*
* @param string $format
* @param boolean $isInline
*
* @return \SMW\ResultPrinter
*/
protected function newInstance( $format, $isInline ) {
$class = $this->getClass();
return new $class( $format, $isInline );
}
/**
* @since 1.8
* @return array
*/
public function instanceProvider() {
$phpFails = [ $this, 'newInstance' ];
return array_map(
function( array $args ) use ( $phpFails ) {
return call_user_func_array( $phpFails, $args );
},
$this->constructorProvider()
);
}
/**
* @dataProvider constructorProvider
*
* @since 1.8
*
* @param string $format
* @param boolean $isInline
*/
public function testConstructor( $format, $isInline ) {
$instance = $this->newInstance( $format, $isInline );
$this->assertInstanceOf( '\SMW\ResultPrinter', $instance );
}
}
/**
* SMWResultPrinter
*
* @deprecated since SMW 1.9
*/
class_alias( 'SMW\Test\QueryPrinterRegistryTestCase', 'SMW\Test\ResultPrinterTestCase' );
|