CouponsTest::testRedeemCoupon()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Xsolla\SDK\Tests\Integration\API;
4
5
use Xsolla\SDK\Exception\API\AccessDeniedException;
6
7
/**
8
 * @group api
9
 */
10
class CouponsTest extends AbstractAPITest
11
{
12 View Code Duplication
    public function testCreateCoupon()
0 ignored issues
show
Duplication introduced by
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...
13
    {
14
        static::$xsollaClient->CreateCoupon([
15
            'campaign_id' => (int) getenv('CAMPAIGN_ID'),
16
            'request' => [
17
                'coupon_code' => uniqid('sdk_coupon_', false),
18
            ],
19
        ]);
20
        static::assertTrue(true);
21
    }
22
23 View Code Duplication
    public function testWrongCreateCoupon()
0 ignored issues
show
Duplication introduced by
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...
24
    {
25
        static::expectException(AccessDeniedException::class);
26
        static::$xsollaClient->CreateCoupon([
27
            'campaign_id' => (int) 2222,
28
            'request' => [
29
                'coupon_code' => uniqid('sdk_coupon_', false),
30
            ],
31
        ]);
32
    }
33
34
    public function testGetCoupon()
35
    {
36
        $actualCouponData = static::$xsollaClient->GetCoupon([
37
            'project_id' => static::$projectId,
38
            'code' => getenv('COUPON_CODE'),
39
        ]);
40
        static::assertInternalType('array', $actualCouponData);
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...
41
    }
42
43
    public function testRedeemCoupon()
44
    {
45
        $actualCouponData = static::$xsollaClient->RedeemCoupon([
46
            'project_id' => static::$projectId,
47
            'code' => getenv('COUPON_CODE'),
48
            'request' => [
49
                'user_id' => static::$userId,
50
            ],
51
        ]);
52
        static::assertInternalType('array', $actualCouponData);
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...
53
    }
54
}
55