1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SFS\Tests; |
4
|
|
|
|
5
|
|
|
use SFS\SemanticFormsSelectInput; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @covers \SFS\SemanticFormsSelectInput |
9
|
|
|
* @group semantic-forms-select |
10
|
|
|
* |
11
|
|
|
* @license GNU GPL v2+ |
12
|
|
|
* @since 3.0.0 |
13
|
|
|
* |
14
|
|
|
* @author FelixAba |
15
|
|
|
*/ |
16
|
|
|
class SemanticFormsSelectInputTest extends \PHPUnit_Framework_TestCase { |
17
|
|
|
|
18
|
|
|
private $SFSInput; |
19
|
|
|
|
20
|
|
|
|
21
|
|
|
protected function setUp() { |
22
|
|
|
parent::setUp(); |
23
|
|
|
$value = ''; |
24
|
|
|
$inputName = ''; |
25
|
|
|
$isMandatory = false; |
26
|
|
|
$isDisabled = false; |
27
|
|
|
|
28
|
|
|
$otherArgs = [ 'template' => 'Foo', 'field' => '', |
29
|
|
|
'function' => 'Bar', 'is_list' => true ]; |
30
|
|
|
|
31
|
|
|
$parserOutput = $this->getMockBuilder( '\ParserOutput' ) |
32
|
|
|
->disableOriginalConstructor()->getMock(); |
33
|
|
|
|
34
|
|
|
$parser = $this->getMockBuilder( '\Parser' ) |
35
|
|
|
->disableOriginalConstructor()->getMock(); |
36
|
|
|
|
37
|
|
|
$parser->expects( $this->any() )->method( 'getOutput' )->will( |
38
|
|
|
$this->returnValue( $parserOutput ) |
39
|
|
|
); |
40
|
|
|
$this->SFSInput = new SemanticFormsSelectInput( |
41
|
|
|
$value, $inputName, $isMandatory, $isDisabled, $otherArgs |
42
|
|
|
); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
protected function tearDown() { |
46
|
|
|
unset( $this->SelectField ); |
47
|
|
|
parent::tearDown(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function testCanConstruct() { |
51
|
|
|
|
52
|
|
|
$this->assertInstanceOf( |
53
|
|
|
'\SFS\SemanticFormsSelectInput', $this->SFSInput |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function testGetHTMLText() { |
58
|
|
|
|
59
|
|
|
$this->assertInternalType( |
60
|
|
|
'string', $this->SFSInput->getHtmlText() |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function testGetName() { |
65
|
|
|
|
66
|
|
|
$this->assertEquals( |
67
|
|
|
'SF_Select', $this->SFSInput->getName() |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function testGetParameters() { |
72
|
|
|
|
73
|
|
|
$this->assertInternalType( 'array', $this->SFSInput->getParameters() ); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
public function testGetResourceModuleNames() { |
78
|
|
|
$rsmn = [ 'ext.sf_select.scriptselect' ]; |
79
|
|
|
|
80
|
|
|
$this->assertEquals( $rsmn, $this->SFSInput->getResourceModuleNames() ); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
|