Issues (31)

php-tests/SimplifiedTests/ServerAdapterTest.php (2 issues)

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