AbstractClientTest::testNormalizeHeaders()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 9.568
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace OAuthTest\Unit\Common\Http;
4
5
use PHPUnit\Framework\TestCase;
6
7
class AbstractClientTest extends TestCase
8
{
9
    /**
10
     * @covers \OAuth\Common\Http\Client\AbstractClient::__construct
11
     */
12
    public function testConstructCorrectInterface(): void
13
    {
14
        $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient');
15
16
        self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client);
17
    }
18
19
    /**
20
     * @covers \OAuth\Common\Http\Client\AbstractClient::__construct
21
     * @covers \OAuth\Common\Http\Client\AbstractClient::setMaxRedirects
22
     */
23
    public function testSetMaxRedirects(): void
24
    {
25
        $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient');
26
27
        self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setMaxRedirects(10));
0 ignored issues
show
Bug introduced by
The method setMaxRedirects() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
        self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setMaxRedirects(10));
0 ignored issues
show
Bug introduced by
The method setMaxRedirects() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
    }
30
31
    /**
32
     * @covers \OAuth\Common\Http\Client\AbstractClient::__construct
33
     * @covers \OAuth\Common\Http\Client\AbstractClient::setTimeout
34
     */
35
    public function testSetTimeout(): void
36
    {
37
        $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient');
38
39
        self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\AbstractClient', $client->setTimeout(25));
0 ignored issues
show
Bug introduced by
The method setTimeout() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
        self::assertInstanceOf('\\OAuth\\Common\\Http\\Client\\ClientInterface', $client->setTimeout(25));
0 ignored issues
show
Bug introduced by
The method setTimeout() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
    }
42
43
    /**
44
     * @covers \OAuth\Common\Http\Client\AbstractClient::__construct
45
     * @covers \OAuth\Common\Http\Client\AbstractClient::normalizeHeaders
46
     */
47
    public function testNormalizeHeaders(): void
48
    {
49
        $client = $this->getMockForAbstractClass('\\OAuth\\Common\\Http\\Client\\AbstractClient');
50
51
        $original = [
52
            'lowercasekey' => 'lowercasevalue',
53
            'UPPERCASEKEY' => 'UPPERCASEVALUE',
54
            'mIxEdCaSeKey' => 'MiXeDcAsEvAlUe',
55
            '31i71casekey' => '31i71casevalue',
56
        ];
57
58
        $goal = [
59
            'lowercasekey' => 'Lowercasekey: lowercasevalue',
60
            'UPPERCASEKEY' => 'Uppercasekey: UPPERCASEVALUE',
61
            'mIxEdCaSeKey' => 'Mixedcasekey: MiXeDcAsEvAlUe',
62
            '31i71casekey' => '31i71casekey: 31i71casevalue',
63
        ];
64
65
        $client->normalizeHeaders($original);
0 ignored issues
show
Bug introduced by
The method normalizeHeaders() does not seem to exist on object<PHPUnit\Framework\MockObject\MockObject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
66
67
        self::assertSame($goal, $original);
68
    }
69
}
70