GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — 3.x (#96)
by Jindřich
02:16
created

RequestPreEventTest::testHeadersOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace Skaut\Skautis\Test\Unit\Wsdl\Event;
7
8
9
use PHPUnit\Framework\TestCase;
10
use Skaut\Skautis\Wsdl\Event\RequestPreEvent;
11
12
class RequestPreEventTest extends TestCase
13
{
14
15
16
    public function testReferenceArgs(): void
17
    {
18
        $args = [[]];
19
        $options = [];
20
        $headers = [];
21
        $trace = debug_backtrace();
22
23
        $event = new RequestPreEvent('asd', $args, $options, $headers, $trace);
24
25
        $event->getArgs()[0]['asd'] = 'qwe';
26
        $this->assertArrayHasKey('asd', $args[0]);
27
        $this->assertSame('qwe', $args[0]['asd']);
28
    }
29
30
    public function testReferenceOptions(): void
31
    {
32
        $args = [[]];
33
        $options = [];
34
        $headers = [];
35
        $trace = debug_backtrace();
36
37
        $event = new RequestPreEvent('asd', $args, $options, $headers, $trace);
38
39
        $event->getOptions()['asd'] = 'qwe';
40
        $this->assertArrayHasKey('asd', $options);
41
        $this->assertSame('qwe', $options['asd']);
42
    }
43
44
    public function testHeadersOptions(): void
45
    {
46
        $args = [[]];
47
        $options = [];
48
        $headers = [];
49
        $trace = debug_backtrace();
50
51
        $event = new RequestPreEvent('asd', $args, $options, $headers, $trace);
52
53
        $event->getInputHeaders()['asd'] = 'qwe';
54
        $this->assertArrayHasKey('asd', $headers);
55
        $this->assertSame('qwe', $headers['asd']);
56
    }
57
58
    public function testDeserialize(): void
59
    {
60
        $args = [
61
            [
62
                'argument' => 'value',
63
            ],
64
        ];
65
66
        $options = [
67
            'option' => 'value'
68
        ];
69
70
        $headers = [
71
            'header' => 'value'
72
        ];
73
74
        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
75
76
        $event = new RequestPreEvent('asd', $args, $options, $headers, $trace);
77
78
        $serialized = serialize($event);
79
        /** @var RequestPreEvent $unserialized */
80
        $unserialized = unserialize($serialized);
81
82
        $this->assertSame('asd', $unserialized->getFname());
83
        $this->assertArrayHasKey(0, $unserialized->getArgs());
84
        $this->assertArrayHasKey('argument', $unserialized->getArgs()[0]);
85
        $this->assertSame('value', $unserialized->getArgs()[0]['argument']);
86
        $this->assertArrayHasKey('option', $unserialized->getOptions());
87
        $this->assertSame('value', $unserialized->getOptions()['option']);
88
        $this->assertArrayHasKey('header', $unserialized->getInputHeaders());
89
        $this->assertSame('value', $unserialized->getInputHeaders()['header']);
90
    }
91
}
92