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/PromotionsTest.php (12 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 PromotionsTest extends AbstractAPITest
9
{
10
    protected static $promotionId;
11
    protected static $couponPromotionId;
12
13
    protected $promotion;
14
15
    public function setUp()
16
    {
17
        parent::setUp();
18
        $this->promotion = [
19
            'technical_name' => uniqid('promotion_', false),
20
            'name' => [
21
                'en' => 'name',
22
            ],
23
            'description' => [
24
                'en' => 'description',
25
            ],
26
            'project_id' => static::$projectId,
27
        ];
28
    }
29
30
    public function testListPromotions()
31
    {
32
        $response = static::$xsollaClient->ListPromotions();
33
        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...
34
    }
35
36
    public function testCreatePromotion()
37
    {
38
        $response = static::$xsollaClient->CreatePromotion([
39
            'request' => $this->promotion,
40
        ]);
41
        static::assertArrayHasKey('id', $response);
42
        static::$promotionId = $response['id'];
43
    }
44
45
    /**
46
     * @depends testCreatePromotion
47
     */
48
    public function testGetPromotion()
49
    {
50
        $response = static::$xsollaClient->GetPromotion([
51
            'promotion_id' => static::$promotionId,
52
        ]);
53
        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...
54
    }
55
56
    /**
57
     * @depends testGetPromotion
58
     */
59
    public function testUpdatePromotion()
60
    {
61
        static::$xsollaClient->UpdatePromotion([
62
            'promotion_id' => static::$promotionId,
63
            'request' => $this->promotion,
64
        ]);
65
        static::assertTrue(true);
66
    }
67
68
    /**
69
     * @depends testUpdatePromotion
70
     */
71
    public function testSetPromotionSubject()
72
    {
73
        static::$xsollaClient->SetPromotionSubject([
74
            'promotion_id' => static::$promotionId,
75
            'request' => [
76
                'purchase' => false,
77
                'items' => null,
78
                'packages' => [1],
79
            ],
80
        ]);
81
        static::assertTrue(true);
82
    }
83
84
    /**
85
     * @depends testSetPromotionSubject
86
     */
87
    public function testGetPromotionSubject()
88
    {
89
        $response = static::$xsollaClient->GetPromotionSubject([
90
            'promotion_id' => static::$promotionId,
91
        ]);
92
        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...
93
    }
94
95
    public function testSetPromotionPaymentSystems()
96
    {
97
        static::markTestIncomplete('We haven\'t allowed payment systems for test project yet.');
98
    }
99
100
    /**
101
     * @depends testGetPromotionSubject
102
     */
103
    public function testGetPromotionPaymentSystems()
104
    {
105
        $response = static::$xsollaClient->GetPromotionPaymentSystems([
106
            'promotion_id' => static::$promotionId,
107
        ]);
108
        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...
109
    }
110
111
    /**
112
     * @depends testGetPromotionPaymentSystems
113
     */
114
    public function testSetPromotionPeriods()
115
    {
116
        $randomFutureTimestamp = mt_rand(time() + 60, 2147483647);
117
        $datetimeStart = \DateTime::createFromFormat('U', $randomFutureTimestamp, new \DateTimeZone('UTC'));
118
        static::$xsollaClient->SetPromotionPeriods([
119
            'promotion_id' => static::$promotionId,
120
            'request' => [
121
                'periods' => [
122
                    [
123
                        'from' => $datetimeStart->format(\DateTime::ISO8601),
124
                        'to' => $datetimeStart->modify('+ 1 second')->format(\DateTime::ISO8601),
125
                    ],
126
                ],
127
            ],
128
        ]);
129
        static::assertTrue(true);
130
    }
131
132
    /**
133
     * @depends testSetPromotionPeriods
134
     */
135
    public function testGetPromotionPeriods()
136
    {
137
        $response = static::$xsollaClient->GetPromotionPeriods([
138
            'promotion_id' => static::$promotionId,
139
        ]);
140
        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...
141
    }
142
143
    /**
144
     * @depends testGetPromotionPeriods
145
     */
146 View Code Duplication
    public function testSetPromotionRewards()
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...
147
    {
148
        static::$xsollaClient->SetPromotionRewards([
149
            'promotion_id' => static::$promotionId,
150
            'request' => [
151
                'purchase' => [
152
                    'discount_percent' => 10,
153
                ],
154
            ],
155
        ]);
156
        static::assertTrue(true);
157
    }
158
159
    /**
160
     * @depends testSetPromotionRewards
161
     */
162
    public function testGetPromotionRewards()
163
    {
164
        $response = static::$xsollaClient->GetPromotionRewards([
165
            'promotion_id' => static::$promotionId,
166
        ]);
167
        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...
168
    }
169
170
    /**
171
     * @depends testGetPromotionRewards
172
     */
173
    public function testReviewPromotion()
174
    {
175
        $response = static::$xsollaClient->ReviewPromotion([
176
            'promotion_id' => static::$promotionId,
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
    /**
182
     * @depends testReviewPromotion
183
     */
184
    public function testCreateCouponPromotion()
185
    {
186
        $response = static::$xsollaClient->CreateCouponPromotion([
187
            'request' => [
188
                'campaign_code' => uniqid('xsolla_api_test_campaign_code_', false),
189
                'project_id' => self::$projectId,
190
                'campaign_names' => ['en' => 'xsolla_api_test_campaign_code'],
191
                'redeems_count_for_user' => 1,
192
                'campaign_redeems_count_for_user' => 1,
193
                'expiration_date' => (new \DateTime('+3day'))->format(DATE_RFC3339),
194
            ],
195
        ]);
196
        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...
197
        static::$couponPromotionId = $response['id'];
198
    }
199
200
    /**
201
     * @depends testCreateCouponPromotion
202
     */
203 View Code Duplication
    public function testGetCouponPromotions()
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...
204
    {
205
        $response = static::$xsollaClient->ListCouponPromotions([
206
            'limit' => 20,
207
            'offset' => 0,
208
        ]);
209
        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...
210
    }
211
212
    /**
213
     * @depends testCreateCouponPromotion
214
     */
215 View Code Duplication
    public function testUpdatePromotionCampaigns()
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...
216
    {
217
        static::$xsollaClient->UpdatePromotionCampaigns([
218
            'promotion_id' => static::$promotionId,
219
            'request' => [
220
                'campaigns' => [static::$couponPromotionId],
221
            ],
222
        ]);
223
        static::assertTrue(true);
224
    }
225
226
    /**
227
     * @depends testUpdatePromotionCampaigns
228
     */
229
    public function testTogglePromotion()
230
    {
231
        static::$xsollaClient->TogglePromotion([
232
            'promotion_id' => static::$promotionId,
233
        ]);
234
        static::assertTrue(true);
235
    }
236
237
    /**
238
     * @depends testUpdatePromotionCampaigns
239
     */
240
    public function testDeletePromotion()
241
    {
242
        static::$xsollaClient->DeletePromotion([
243
            'promotion_id' => static::$promotionId,
244
        ]);
245
        static::assertTrue(true);
246
    }
247
}
248