OAuth2ClientTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 2
eloc 10
c 3
b 1
f 0
dl 0
loc 18
rs 10
ccs 8
cts 8
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateAuthorizationUrl() 0 16 2
1
<?php
2
/**
3
 * @project tiktok-marketing-api
4
 */
5
6
namespace Promopult\TikTokMarketingApi\Tests;
7
8
use Promopult\TikTokMarketingApi\OAuth2Client;
9
use PHPUnit\Framework\TestCase;
10
11
class OAuth2ClientTest extends TestCase
12
{
13 1
    public function testCreateAuthorizationUrl()
14
    {
15 1
        $expected = 'https://ads.tiktok.com/marketing_api/auth?app_id=appId&state=state&redirect_uri=redirectUri&scope=%5B1%2C2%5D';
16 1
17 1
        $actual = OAuth2Client::createAuthorizationUrl(
18
            'appId',
19 1
            'redirectUri',
20
            'state',
21 1
            [1, 2],
22 1
            'https://ads.tiktok.com'
23
        );
24 1
25
        $partsToTest = [PHP_URL_HOST, PHP_URL_PATH, PHP_URL_QUERY, PHP_URL_SCHEME];
26
27
        foreach ($partsToTest as $part) {
28
            $this->assertEquals(parse_url($expected, $part), parse_url($actual, $part));
29
        }
30
    }
31
}
32