Completed
Push — user_validation ( d439b2 )
by
unknown
08:05
created

PinCodeResponseTest::testPinCodeIsEmptyString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Xsolla\SDK\Tests\Webhook\Message;
4
5
use Xsolla\SDK\Webhook\Response\PinCodeResponse;
6
7
/**
8
 * @group unit
9
 */
10
class PinCodeResponseTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testPinCodeHasInvalidType()
13
    {
14
        $this->setExpectedException(
15
            '\Xsolla\SDK\Exception\Webhook\XsollaWebhookException',
16
            'Pin code should be non-empty string. stdClass given'
17
        );
18
        new PinCodeResponse(new \StdClass());
19
    }
20
21
    public function testPinCodeIsEmptyString()
22
    {
23
        $this->setExpectedException(
24
            '\Xsolla\SDK\Exception\Webhook\XsollaWebhookException',
25
            'Pin code should be non-empty string. NULL given'
26
        );
27
        new PinCodeResponse(null);
28
    }
29
30
    public function testPinCodeIsNull()
31
    {
32
        $this->setExpectedException(
33
            '\Xsolla\SDK\Exception\Webhook\XsollaWebhookException',
34
            'Pin code should be non-empty string. Empty string given'
35
        );
36
        new PinCodeResponse('');
37
    }
38
39
    public function testPinCodeResponse()
40
    {
41
        $response = new PinCodeResponse('pin_code');
42
        $this->assertJsonStringEqualsJsonString(
43
            '{"pin_code":"pin_code"}',
44
            $response->getSymfonyResponse()->getContent()
45
        );
46
    }
47
}
48