| 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
Loading history...
|
|||
| 11 | class VatNumberCheckHelperTest extends CakeTestCase { |
||
|
0 ignored issues
–
show
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. 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
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. 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
|
|||
| 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 | $actual = $this->VatNumberCheck->input($fieldName); |
||
| 44 | |||
| 45 | // Test name and id properties |
||
| 46 | $this->assertPattern('/name\=\"data\[Foo\]\[bar\]\"/', $actual); |
||
| 47 | $this->assertPattern('/id\=\"FooBar\"/', $actual); |
||
| 48 | |||
| 49 | // Test class property -> only + append |
||
| 50 | $options = []; |
||
| 51 | $actual = $this->VatNumberCheck->input($fieldName, $options); |
||
| 52 | $this->assertPattern('/class\=\"vat-number-check\"/', $actual); |
||
| 53 | |||
| 54 | $options = ['class' => 'foo-bar']; |
||
| 55 | $actual = $this->VatNumberCheck->input($fieldName, $options); |
||
| 56 | $this->assertPattern('/class\=\"foo-bar vat-number-check\"/', $actual); |
||
| 57 | |||
| 58 | // Test input type |
||
| 59 | $options = ['type' => 'radio']; |
||
| 60 | $actual = $this->VatNumberCheck->input($fieldName, $options); |
||
| 61 | $this->assertPattern('/type\=\"text\"/', $actual); |
||
| 62 | } |
||
| 63 | |||
| 64 | } |
||
| 65 |