UserAttributesTest::testGetUserAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
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 UserAttributesTest extends AbstractAPITest
9
{
10
    protected static $attributeId;
11
12
    protected $userAttribute;
13
14
    public function setUp()
15
    {
16
        parent::setUp();
17
        $this->userAttribute = [
18
            'key' => uniqid('user_attribute_', false),
19
            'name' => [
20
                'en' => 'name',
21
            ],
22
            'type' => 'string',
23
        ];
24
    }
25
26
    public function testCreateUserAttribute()
27
    {
28
        $response = static::$xsollaClient->CreateUserAttribute([
29
            'project_id' => static::$projectId,
30
            'request' => $this->userAttribute,
31
        ]);
32
        static::assertArrayHasKey('id', $response);
33
        static::$attributeId = (int) $response['id'];
34
    }
35
36
    /**
37
     * @depends testCreateUserAttribute
38
     */
39
    public function testGetUserAttribute()
40
    {
41
        $response = static::$xsollaClient->GetUserAttribute([
42
            'project_id' => static::$projectId,
43
            'user_attribute_id' => static::$attributeId,
44
        ]);
45
        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...
46
    }
47
48
    /**
49
     * @depends testGetUserAttribute
50
     */
51
    public function testUpdateUserAttribute()
52
    {
53
        static::$xsollaClient->UpdateUserAttribute([
54
            'project_id' => static::$projectId,
55
            'user_attribute_id' => static::$attributeId,
56
            'request' => $this->userAttribute,
57
        ]);
58
        static::assertTrue(true);
59
    }
60
61
    /**
62
     * @depends testUpdateUserAttribute
63
     */
64
    public function testListUserAttributes()
65
    {
66
        $response = static::$xsollaClient->ListUserAttributes([
67
            'project_id' => static::$projectId,
68
        ]);
69
        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...
70
    }
71
72
    /**
73
     * @depends testListUserAttributes
74
     */
75
    public function testDeleteUserAttribute()
76
    {
77
        static::$xsollaClient->DeleteUserAttribute([
78
            'project_id' => static::$projectId,
79
            'user_attribute_id' => static::$attributeId,
80
        ]);
81
        static::assertTrue(true);
82
    }
83
}
84