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

PinCodeResponseTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 38
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testPinCodeHasInvalidType() 0 8 1
A testPinCodeIsEmptyString() 0 8 1
A testPinCodeIsNull() 0 8 1
A testPinCodeResponse() 0 8 1
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