CreateSubscriptionMessageTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A test() 0 6 1
1
<?php
2
3
namespace Xsolla\SDK\Tests\Unit\Webhook\Message;
4
5
use PHPUnit\Framework\TestCase;
6
use Xsolla\SDK\Webhook\Message\CreateSubscriptionMessage;
7
8
/**
9
 * @group unit
10
 */
11
class CreateSubscriptionMessageTest extends TestCase
12
{
13
    protected $request = [
14
        'notification_type' => 'create_subscription',
15
        'user' => [
16
                'id' => '1234567',
17
                'name' => 'Xsolla User',
18
            ],
19
        'subscription' => [
20
                'plan_id' => 1,
21
                'subscription_id' => '10',
22
                'product_id' => 'Demo Product',
23
                'date_create' => '2014-09-22T19:25:25+04:00',
24
                'date_next_charge' => '2015-01-22T19:25:25+04:00',
25
                'trial' => [
26
                        'value' => 90,
27
                        'type' => 'day',
28
                    ],
29
            ],
30
        'coupon' => [
31
                'coupon_code' => 'ICvj45S4FUOyy',
32
                'campaign_code' => '1507',
33
            ],
34
    ];
35
36
    public function test()
37
    {
38
        $message = new CreateSubscriptionMessage($this->request);
39
        static::assertSame($this->request['subscription'], $message->getSubscription());
40
        static::assertSame($this->request['coupon'], $message->getCoupon());
41
    }
42
}
43