summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Query/ResultPrinters/ListResultPrinterTest.php
blob: 1c2393eeb711c26cc912df5e8f68bdf7c9016944 (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
<?php
namespace SMW\Tests\Query\ResultPrinters;

use SMW\Message;
use SMW\Query\ResultPrinters\ListResultPrinter;

/**
 * @covers \SMW\Query\ResultPrinters\ListResultPrinter
 * @group semantic-mediawiki
 *
 * @license GNU GPL v2+
 * @since 3.0
 *
 * @author Máté Szabó
 * @author Stephan Gambke
 */
class ListResultPrinterTest extends \PHPUnit_Framework_TestCase {

	/**
	 * @dataProvider allFormatsProvider
	 * @param string $format
	 */
	public function testCanConstruct( $format ) {
		$listResultPrinter = new ListResultPrinter( $format );

		$this->assertInstanceOf( '\SMW\Query\ResultPrinters\ListResultPrinter', $listResultPrinter );
	}

	/**
	 * @dataProvider allFormatsProvider
	 * @param string $format
	 */
	public function testSupportsRecursiveAnnotation( $format ) {
		$listResultPrinter = new ListResultPrinter( $format );

		$this->assertTrue( $listResultPrinter->supportsRecursiveAnnotation() );
	}

	/**
	 * @dataProvider allFormatsProvider
	 * @param string $format
	 */
	public function testIsDeferrable( $format ) {
		$listResultPrinter = new ListResultPrinter( $format );

		$this->assertTrue( $listResultPrinter->isDeferrable() );
	}

	/**
	 * @dataProvider allFormatsProvider
	 * @param string $format
	 */
	public function testGetName( $format ) {
		$listResultPrinter = new ListResultPrinter( $format );

		$this->assertEquals( Message::get( 'smw_printername_' . $format ), $listResultPrinter->getName() );
	}

	public function allFormatsProvider() {
		yield [ 'ul' ];
		yield [ 'ol' ];
		yield [ 'template' ];
		yield [ 'list' ];
		yield [ 'plainlist' ];
	}
}