Issues (94)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

tests/Integration/API/SubscriptionsTest.php (19 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Xsolla\SDK\Tests\Integration\API;
4
5
/**
6
 * @group api
7
 */
8
class SubscriptionsTest extends AbstractAPITest
9
{
10
    protected static $planId;
11
12
    protected static $productId;
13
14
    protected $plan = [
15
        'name' => [
16
            'en' => 'Subscription Plan Name',
17
        ],
18
        'group_id' => 'group_id',
19
        'charge' => [
20
            'amount' => 1,
21
            'currency' => 'USD',
22
            'period' => [
23
                'value' => 1,
24
                'type' => 'month',
25
            ],
26
        ],
27
        'expiration' => [
28
            'value' => 3,
29
            'type' => 'month',
30
        ],
31
    ];
32
33
    protected $product = [
34
        'name' => 'Product Name',
35
        'group_id' => 'group_id',
36
    ];
37
38
    public function testCreateSubscriptionPlan()
39
    {
40
        $response = static::$xsollaClient->CreateSubscriptionPlan([
41
            'project_id' => static::$projectId,
42
            'request' => $this->plan,
43
        ]);
44
        static::assertArrayHasKey('plan_id', $response);
45
        static::assertInternalType('integer', $response['plan_id']);
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
        static::$planId = $response['plan_id'];
47
    }
48
49
    /**
50
     * @depends testCreateSubscriptionPlan
51
     */
52
    public function testListSubscriptionPlans()
53
    {
54
        $response = static::$xsollaClient->ListSubscriptionPlans([
55
            'project_id' => static::$projectId,
56
            'limit' => 100,
57
        ]);
58
        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...
59
    }
60
61
    /**
62
     * @depends testListSubscriptionPlans
63
     */
64
    public function testUpdateSubscriptionPlan()
65
    {
66
        $response = static::$xsollaClient->UpdateSubscriptionPlan([
67
            'project_id' => static::$projectId,
68
            'plan_id' => static::$planId,
69
            'request' => $this->plan,
70
        ]);
71
        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...
72
    }
73
74
    /**
75
     * @depends testUpdateSubscriptionPlan
76
     */
77 View Code Duplication
    public function testDisableSubscriptionPlan()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78
    {
79
        static::$xsollaClient->DisableSubscriptionPlan([
80
            'project_id' => static::$projectId,
81
            'plan_id' => static::$planId,
82
        ]);
83
        static::assertTrue(true);
84
    }
85
86
    /**
87
     * @depends testDisableSubscriptionPlan
88
     */
89 View Code Duplication
    public function testEnableSubscriptionPlan()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
90
    {
91
        static::$xsollaClient->EnableSubscriptionPlan([
92
            'project_id' => static::$projectId,
93
            'plan_id' => static::$planId,
94
        ]);
95
        static::assertTrue(true);
96
    }
97
98
    /**
99
     * @depends testEnableSubscriptionPlan
100
     */
101 View Code Duplication
    public function testDeleteSubscriptionPlan()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
102
    {
103
        static::$xsollaClient->DeleteSubscriptionPlan([
104
            'project_id' => static::$projectId,
105
            'plan_id' => static::$planId,
106
        ]);
107
        static::assertTrue(true);
108
    }
109
110
    /**
111
     * @depends testDeleteSubscriptionPlan
112
     */
113 View Code Duplication
    public function testCreateSubscriptionProduct()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
114
    {
115
        $response = static::$xsollaClient->CreateSubscriptionProduct([
116
            'project_id' => static::$projectId,
117
            'request' => $this->product,
118
        ]);
119
        static::assertArrayHasKey('product_id', $response);
120
        static::$productId = $response['product_id'];
121
    }
122
123
    /**
124
     * @depends testCreateSubscriptionProduct
125
     */
126
    public function testListSubscriptionPlansWithParams()
127
    {
128
        $response = static::$xsollaClient->ListSubscriptionPlans([
129
            'project_id' => static::$projectId,
130
            'limit' => 100,
131
            'offset' => 0,
132
            'product_id' => static::$productId,
133
            'group_id' => $this->product['group_id'],
134
            'external_id' => 12345,
135
        ]);
136
        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...
137
    }
138
139
    /**
140
     * @depends testCreateSubscriptionProduct
141
     */
142 View Code Duplication
    public function testUpdateSubscriptionProduct()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
143
    {
144
        $response = static::$xsollaClient->UpdateSubscriptionProduct([
145
            'project_id' => static::$projectId,
146
            'product_id' => static::$productId,
147
            'request' => $this->product,
148
        ]);
149
        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...
150
    }
151
152
    /**
153
     * @depends testUpdateSubscriptionProduct
154
     */
155
    public function testDeleteSubscriptionProduct()
156
    {
157
        static::$xsollaClient->DeleteSubscriptionProduct([
158
            'project_id' => static::$projectId,
159
            'product_id' => static::$productId,
160
        ]);
161
        static::assertTrue(true);
162
    }
163
164
    public function testListSubscriptionProducts()
165
    {
166
        $response = static::$xsollaClient->ListSubscriptionProducts([
167
            'project_id' => static::$projectId,
168
        ]);
169
        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...
170
    }
171
172
    public function testListSubscriptionProductsWithParams()
173
    {
174
        $response = static::$xsollaClient->ListSubscriptionProducts([
175
            'project_id' => static::$projectId,
176
            'product_id' => static::$productId,
177
        ]);
178
        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...
179
    }
180
181
    public function testUpdateSubscription()
182
    {
183
        static::markTestIncomplete('We haven\'t active subscriptions in test project.');
184
    }
185
186 View Code Duplication
    public function testListSubscriptions()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
187
    {
188
        $response = static::$xsollaClient->ListSubscriptions([
189
            'project_id' => static::$projectId,
190
            'user_id' => static::$userId,
191
        ]);
192
        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...
193
    }
194
195
    public function testListSubscriptionWithParams()
196
    {
197
        $response = static::$xsollaClient->ListSubscriptions([
198
            'project_id' => static::$projectId,
199
            'user_id' => static::$userId,
200
            'plan_id' => static::$planId,
201
            'product_id' => static::$productId,
202
        ]);
203
        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...
204
    }
205
206 View Code Duplication
    public function testListUserSubscriptionPayments()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
207
    {
208
        $response = static::$xsollaClient->ListUserSubscriptionPayments([
209
            'project_id' => static::$projectId,
210
            'user_id' => static::$userId,
211
        ]);
212
        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...
213
    }
214
215
    public function testListSubscriptionPayments()
216
    {
217
        $response = static::$xsollaClient->ListSubscriptionPayments([
218
            'project_id' => static::$projectId,
219
        ]);
220
        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...
221
    }
222
223
    public function testListSubscriptionCurrencies()
224
    {
225
        $response = static::$xsollaClient->ListSubscriptionCurrencies([
226
            'project_id' => static::$projectId,
227
        ]);
228
        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...
229
    }
230
}
231