Passed
Pull Request — master (#2)
by
unknown
05:11
created

VatNumberCheckHelperTest::testInput()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 22
c 0
b 0
f 0
rs 9.7998
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
		var_dump($actual);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($actual) looks like debug code. Are you sure you do not want to remove it?
Loading history...
48
49
		// Test name and id properties
50
		$this->assertContains('name="Foo[bar]"', $actual);
51
		$this->assertContains('id="foo-bar"', $actual);
52
53
		// Test class property -> only + append
54
		$options = [];
55
		$actual = $this->VatNumberCheck->input($fieldName, $options);
56
		$this->assertContains('class="vat-number-check"', $actual);
57
58
		$options = ['class' => 'foo-bar'];
59
		$actual = $this->VatNumberCheck->input($fieldName, $options);
60
		$this->assertContains('class="foo-bar vat-number-check"', $actual);
61
62
		// Test input type
63
		$options = ['type' => 'radio'];
64
		$actual = $this->VatNumberCheck->input($fieldName, $options);
65
		$this->assertContains('type="text"', $actual);
66
	}
67
68
}
69