Completed
Pull Request — master (#71)
by Toni Hermoso
22:26
created

SemanticFormsSelectInputTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 68
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 23 1
A tearDown() 0 4 1
A testCanConstruct() 0 6 1
A testGetHTMLText() 0 6 1
A testGetName() 0 6 1
A testGetParameters() 0 4 1
A testGetResourceModuleNames() 0 5 1
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