ServerAdapterTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testDie2() 0 5 1
A testDie1() 0 5 1
A testPass() 0 8 1
A testIterator() 0 4 1
1
<?php
2
3
namespace SimplifiedTests;
4
5
6
use CommonTestClass;
7
use kalanis\kw_input\InputException;
8
use kalanis\kw_input\Simplified;
9
10
11
class ServerAdapterTest extends CommonTestClass
12
{
13
    public function testPass(): void
14
    {
15
        $data = new Simplified\ServerAdapter();
16
        $this->assertInstanceOf(\ArrayAccess::class, $data);
17
        $this->assertTrue(isset($data->PHP_SELF));
18
        $this->assertTrue(isset($data['PHP_SELF']));
19
        $data->PHP_SELF;
20
        $data['PHP_SELF'];
21
    }
22
23
    public function testDie1(): void
24
    {
25
        $data = new Simplified\ServerAdapter();
26
        $this->expectException(InputException::class);
27
        $data->foz = 'wuz';
0 ignored issues
show
Bug Best Practice introduced by
The property foz does not exist on kalanis\kw_input\Simplified\ServerAdapter. Since you implemented __set, consider adding a @property annotation.
Loading history...
28
    }
29
30
    public function testDie2(): void
31
    {
32
        $data = new Simplified\ServerAdapter();
33
        $this->expectException(InputException::class);
34
        unset($data->foz);
0 ignored issues
show
Bug Best Practice introduced by
The property foz does not exist on kalanis\kw_input\Simplified\ServerAdapter. Since you implemented __get, consider adding a @property annotation.
Loading history...
35
    }
36
37
    public function testIterator(): void
38
    {
39
        $data = new Simplified\ServerAdapter();
40
        $this->assertNotEmpty(iterator_to_array($data->getIterator()));
41
    }
42
}
43