Completed
Pull Request — master (#2)
by
unknown
05:39
created

VatNumberCheckHelperTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace VatNumberCheck\Test\TestCase\View\Helper;
3
4
use Cake\TestSuite\TestCase;
5
use Cake\View\View;
6
use VatNumberCheck\View\Helper\VatNumberCheckHelper;
7
8
/**
9
 * VatNumberCheckHelper Test Case.
10
 *
11
 * @property \VatNumberCheck\Test\TestCase\View\Helper $VatNumberCheck
12
 */
13
 class VatNumberCheckHelperTest extends TestCase
14
{
15
16
/**
17
 * setUp method
18
 *
19
 * @return void
20
 */
21
	public function setUp() {
22
		parent::setUp();
23
24
		$View = new View();
25
		$this->VatNumberCheck = new VatNumberCheckHelper($View);
0 ignored issues
show
Documentation Bug introduced by
It seems like new VatNumberCheck\View\...umberCheckHelper($View) of type VatNumberCheck\View\Helper\VatNumberCheckHelper is incompatible with the declared type VatNumberCheck\Test\TestCase\View\Helper of property $VatNumberCheck.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
26
	}
27
28
/**
29
 * tearDown method
30
 *
31
 * @return void
32
 */
33
	public function tearDown() {
34
		unset($this->VatNumberCheck);
35
36
		parent::tearDown();
37
	}
38
39
/**
40
 * testInput method
41
 *
42
 * @return void
43
 */
44
	public function testInput() {
45
		$fieldName = 'Foo.bar';
46
		$actual = $this->VatNumberCheck->input($fieldName);
47
48
		// Test name and id properties
49
		$this->assertContains('name="Foo[bar]"', $actual);
50
		$this->assertContains('id="foo-bar"', $actual);
51
52
		// Test class property -> only + append
53
		$options = [];
54
		$actual = $this->VatNumberCheck->input($fieldName, $options);
55
		$this->assertContains('class="vat-number-check"', $actual);
56
57
		$options = ['class' => 'foo-bar'];
58
		$actual = $this->VatNumberCheck->input($fieldName, $options);
59
		$this->assertContains('class="foo-bar vat-number-check"', $actual);
60
61
		// Test input type
62
		$options = ['type' => 'radio'];
63
		$actual = $this->VatNumberCheck->input($fieldName, $options);
64
		$this->assertContains('type="text"', $actual);
65
	}
66
67
}
68