PinCodeResponseTest::testPinCodeResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Xsolla\SDK\Tests\Unit\Webhook\Message;
4
5
use PHPUnit\Framework\TestCase;
6
use Xsolla\SDK\Webhook\Response\PinCodeResponse;
7
8
/**
9
 * @group unit
10
 */
11
class PinCodeResponseTest extends TestCase
12
{
13
    public function testPinCodeHasInvalidType()
14
    {
15
        $this->expectException('\Xsolla\SDK\Exception\Webhook\XsollaWebhookException');
16
        $this->expectExceptionMessage('Pin code should be non-empty string. stdClass given');
17
18
        new PinCodeResponse(new \stdClass());
19
    }
20
21
    public function testPinCodeIsEmptyString()
22
    {
23
        $this->expectException('\Xsolla\SDK\Exception\Webhook\XsollaWebhookException');
24
        $this->expectExceptionMessage('Pin code should be non-empty string. NULL give');
25
26
        new PinCodeResponse(null);
27
    }
28
29
    public function testPinCodeIsNull()
30
    {
31
        $this->expectException('\Xsolla\SDK\Exception\Webhook\XsollaWebhookException');
32
        $this->expectExceptionMessage('Pin code should be non-empty string. Empty string given');
33
34
        new PinCodeResponse('');
35
    }
36
37
    public function testPinCodeResponse()
38
    {
39
        $response = new PinCodeResponse('pin_code');
40
        $this->assertJsonStringEqualsJsonString('{"pin_code":"pin_code"}', $response->getSymfonyResponse()->getContent());
0 ignored issues
show
Security Bug introduced by
It seems like $response->getSymfonyResponse()->getContent() targeting Symfony\Component\HttpFo...\Response::getContent() can also be of type false; however, PHPUnit\Framework\Assert...tringEqualsJsonString() does only seem to accept string, did you maybe forget to handle an error condition?
Loading history...
41
    }
42
}
43