Completed
Push — master ( 66631d...a00063 )
by
unknown
9s
created

PinCodeResponseTest::testPinCodeIsNull()   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(
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
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(
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
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(
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
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