blob: efceebd6a67d1cd4ae711d436601df6bcb563705 (
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
|
<?php
namespace SMW\Tests\MediaWiki\Specials\Ask;
use SMW\MediaWiki\Specials\Ask\FormatListWidget;
use SMW\Tests\TestEnvironment;
/**
* @covers \SMW\MediaWiki\Specials\Ask\FormatListWidget
* @group semantic-mediawiki
*
* @license GNU GPL v2+
* @since 3.0
*
* @author mwjames
*/
class FormatListWidgetTest extends \PHPUnit_Framework_TestCase {
public function testEmptyParameters() {
$stringValidator = TestEnvironment::newValidatorFactory()->newStringValidator();
$title = $this->getMockBuilder( '\Title' )
->disableOriginalConstructor()
->getMock();
$stringValidator->assertThatStringContains(
[
'<span class="smw-ask-format-list"><input type="hidden" value="yes" name="eq"',
'<option value="broadtable" selected="">.*</option>'
],
FormatListWidget::selectList( $title, [] )
);
}
public function testSetResultFormats() {
$stringValidator = TestEnvironment::newValidatorFactory()->newStringValidator();
$title = $this->getMockBuilder( '\Title' )
->disableOriginalConstructor()
->getMock();
FormatListWidget::setResultFormats(
[
'rdf' => 'SomeClassReference'
]
);
$stringValidator->assertThatStringContains(
[
'<option value="broadtable">.*</option>',
'<option data-isexport="1" value="rdf" selected="">.*</option>'
],
FormatListWidget::selectList( $title, [ 'format' => 'rdf' ] )
);
}
}
|