Passed
Push — master ( f75ef5...782b7a )
by Matthieu
05:01
created

LicenseListenerTest::testLicenseListenerIsOk()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AtlassianConnectBundle\Tests\Functional;
6
7
final class LicenseListenerTest extends AbstractWebTestCase
8
{
9
    public function testLicenseListenerIsOk(): void
10
    {
11
        $client = self::createClient(['environment' => 'prod'], ['HTTP_AUTHORIZATION' => 'Bearer '.$this->getTenantJWTCode()]);
12
13
        $client->request('GET', '/protected/license-route');
14
        $this->assertResponseIsSuccessful();
15
    }
16
17
    public function testLicenseListenerFails(): void
18
    {
19
        $client = self::createClient(['environment' => 'prod'], ['HTTP_AUTHORIZATION' => 'Bearer '.$this->getTenantJWTCode('not_whitelisted')]);
20
21
        $client->request('GET', '/protected/license-route');
22
        $this->assertResponseRedirects('/protected/unlicensed');
23
    }
24
25
    public function testLicenseListenerWorksInDev(): void
26
    {
27
        $client = self::createClient(['environment' => 'dev'], ['HTTP_AUTHORIZATION' => 'Bearer '.$this->getTenantJWTCode('not_whitelisted')]);
28
29
        $client->request('GET', '/protected/license-route');
30
        $this->assertResponseIsSuccessful();
31
    }
32
}
33