IntegerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A testInteger() 0 12 1
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