GameDeliveryTest::testCreateGameDeliveryEntity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Xsolla\SDK\Tests\Integration\API;
4
5
/**
6
 * @group api
7
 */
8
class GameDeliveryTest extends AbstractAPITest
9
{
10
    /**
11
     * @var int
12
     */
13
    protected static $gameDeliveryEntityId;
14
15
    private $gameDeliveryEntityTemplate = [
16
        'sku' => 'sdk-test',
17
        'name' => [
18
            'en' => 'sdk-test name-en',
19
        ],
20
        'description' => [
21
            'en' => 'sdk-test description-en',
22
        ],
23
        'system_requirements' => 'sdk-test system_requirements',
24
        'default_currency' => 'USD',
25
        'drm' => [
26
            [
27
                'id' => 1,
28
                'platforms' => [
29
                    [
30
                        'id' => 1,
31
                    ],
32
                ],
33
            ],
34
            [
35
                'id' => 6,
36
                'enabled' => true,
37
            ],
38
        ],
39
        'delivery' => [
40
            'release_date_type' => 'exact_date',
41
            'delivery_method' => [
42
                'default' => [
43
                    'link',
44
                ],
45
                'exceptions' => [],
46
            ],
47
            'is_pre_order' => false,
48
            'is_partner_side_processing' => false,
49
        ],
50
    ];
51
52
    public static function setUpBeforeClass()
53
    {
54
        parent::setUpBeforeClass();
55
        static::$gameDeliveryEntityId = (int) getenv('GAME_DELIVERY_ENTITY_ID');
56
    }
57
58
    public function testListGameDeliveryDrmPlatforms()
59
    {
60
        $response = static::$xsollaClient->ListGameDeliveryDrmPlatforms();
61
        static::assertArrayHasKey('platforms', $response);
62
        static::assertArrayHasKey('drm', $response);
63
    }
64
65
    public function testCreateGameDeliveryEntity()
66
    {
67
        static::markTestIncomplete('Delete game delivery entity API method not implemented yet. We should not create new entities infinitely.');
68
    }
69
70
    public function testListGameDeliveryEntities()
71
    {
72
        $response = static::$xsollaClient->ListGameDeliveryEntities([
73
            'project_id' => static::$projectId,
74
        ]);
75
        static::assertInternalType('array', $response);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::assertInternalType() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3369

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...
76
        static::assertArrayHasKey('id', current($response));
77
    }
78
79
    public function testGetGameDeliveryEntity()
80
    {
81
        $response = static::$xsollaClient->GetGameDeliveryEntity([
82
            'project_id' => static::$projectId,
83
            'game_delivery_id' => static::$gameDeliveryEntityId,
84
        ]);
85
        static::assertSame(static::$gameDeliveryEntityId, $response['id']);
86
    }
87
88
    public function testUpdateGameDeliveryEntity()
89
    {
90
        static::$xsollaClient->UpdateGameDeliveryEntity([
91
            'project_id' => static::$projectId,
92
            'game_delivery_id' => static::$gameDeliveryEntityId,
93
            'request' => $this->gameDeliveryEntityTemplate,
94
        ]);
95
        static::assertTrue(true);
96
    }
97
}
98