IntegerTest::testInteger()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace devtoolboxuk\soteria;
4
5
use PHPUnit\Framework\TestCase;
6
7
class IntegerTest extends TestCase
8
{
9
10
    private $sanitise;
11
12
    function __construct($name = null, array $data = [], $dataName = '')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
13
    {
14
        parent::__construct($name, $data, $dataName);
15
        $this->security = new SoteriaService();
0 ignored issues
show
Bug introduced by
The property security does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
16
        $this->sanitise = $this->security->sanitise();
17
    }
18
19
    function testInteger()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
20
    {
21
        $this->sanitise->disinfect(12, 'integer');
22
23
        $result = $this->sanitise->result();
24
25
26
        $this->assertTrue($result->isValid());
27
//        if ($result->isValid()) {
28
//            echo "\nValid";
29
//        }
30
    }
31
32
}
33