ClientFunctionalityTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 10

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFunctionality() 0 33 2
1
<?php declare(strict_types = 1);
2
3
namespace SlevomatEET;
4
5
use Composer\CaBundle\CaBundle;
6
use DateTimeImmutable;
7
use GuzzleHttp\Client as GuzzleClient;
8
use GuzzleHttp\RequestOptions;
9
use PHPUnit\Framework\TestCase;
10
use SlevomatEET\Cryptography\CryptographyService;
11
use SlevomatEET\Driver\GuzzleSoapClientDriver;
12
13
class ClientFunctionalityTest extends TestCase
14
{
15
16
	public function testFunctionality(): void
17
	{
18
		if (getenv('TRAVIS') !== false) {
19
			$this->markTestSkipped('EET is blocking Travis CI :(');
20
		}
21
		$crypto = new CryptographyService(__DIR__ . '/../../cert/EET_CA1_Playground-CZ00000019.key', __DIR__ . '/../../cert/EET_CA1_Playground-CZ00000019.pub');
22
		$configuration = new Configuration('CZ00000019', '273', '/5546/RO24', EvidenceEnvironment::get(EvidenceEnvironment::PLAYGROUND), false);
23
		$client = new Client(
24
			$crypto,
25
			$configuration,
26
			new GuzzleSoapClientDriver(
27
				new GuzzleClient(
28
					[RequestOptions::VERIFY => CaBundle::getBundledCaBundlePath()]
29
				)
30
			)
31
		);
32
33
		$receipt = new Receipt(
34
			true,
35
			'CZ683555118',
36
			'0/6460/ZQ42',
37
			new DateTimeImmutable('2016-11-01 00:30:12'),
38
			3411300
39
		);
40
41
		$response = $client->send($receipt);
42
43
		$this->assertInstanceOf(EvidenceResponse::class, $response);
44
		$this->assertTrue($response->isValid());
45
		$this->assertNotNull($response->getFik());
46
		$this->assertNotNull($response->getUuid());
47
		$this->assertTrue($response->isTest());
48
	}
49
50
}
51