VatNumberCheckHelperTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
App::uses('View', 'View');
3
App::uses('Helper', 'View');
4
App::uses('VatNumberCheckHelper', 'VatNumberCheck.View/Helper');
5
6
/**
7
 * VatNumberCheckHelper Test Case
8
 *
9
 * @property VatNumberCheck.VatNumberCheckHelper $VatNumberCheck
10
 */
0 ignored issues
show
Documentation Bug introduced by
The doc comment VatNumberCheck.VatNumberCheckHelper at position 0 could not be parsed: Unknown type name 'VatNumberCheck.VatNumberCheckHelper' at position 0 in VatNumberCheck.VatNumberCheckHelper.
Loading history...
11
class VatNumberCheckHelperTest extends CakeTestCase {
0 ignored issues
show
Bug introduced by
The type CakeTestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
/**
14
 * setUp method
15
 *
16
 * @return void
17
 */
18
	public function setUp() {
19
		parent::setUp();
20
21
		$View = new View();
0 ignored issues
show
Bug introduced by
The type View was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
		$this->VatNumberCheck = new VatNumberCheckHelper($View);
0 ignored issues
show
Bug Best Practice introduced by
The property VatNumberCheck does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23
	}
24
25
/**
26
 * tearDown method
27
 *
28
 * @return void
29
 */
30
	public function tearDown() {
31
		unset($this->VatNumberCheck);
32
33
		parent::tearDown();
34
	}
35
36
/**
37
 * testInput method
38
 *
39
 * @return void
40
 */
41
	public function testInput() {
42
		$fieldName = 'Foo.bar';
43
		$result = $this->VatNumberCheck->input($fieldName);
44
45
		// Test name and id properties
46
		$this->assertPattern('/name\=\"data\[Foo\]\[bar\]\"/', $result);
47
		$this->assertPattern('/id\=\"FooBar\"/', $result);
48
49
		// Test class property -> only + append
50
		$options = [];
51
		$result = $this->VatNumberCheck->input($fieldName, $options);
52
		$this->assertPattern('/class\=\"vat-number-check\"/', $result);
53
54
		$options = ['class' => 'foo-bar'];
55
		$result = $this->VatNumberCheck->input($fieldName, $options);
56
		$this->assertPattern('/class\=\"foo-bar vat-number-check\"/', $result);
57
58
		// Test input type
59
		$options = ['type' => 'radio'];
60
		$result = $this->VatNumberCheck->input($fieldName, $options);
61
		$this->assertPattern('/type\=\"text\"/', $result);
62
	}
63
64
}
65