ServiceUnitTests::testExceptionWhileConstruction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 12
rs 10
c 2
b 0
f 0
1
<?php
2
namespace Mezon\Service\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Mezon\Security\MockProvider;
6
use Mezon\Service\Tests\Mocks\TestingTransport;
7
8
/**
9
 * Class ServiceUnitTests
10
 *
11
 * @package Service
12
 * @subpackage ServiceUnitTests
13
 * @author Dodonov A.A.
14
 * @version v.1.0 (2019/08/17)
15
 * @copyright Copyright (c) 2019, aeon.org
16
 */
17
18
/**
19
 * Common service unit tests
20
 *
21
 * @author Dodonov A.A.
22
 * @psalm-suppress PropertyNotSetInConstructor
23
 */
24
class ServiceUnitTests extends TestCase
25
{
26
27
    /**
28
     * Testing method
29
     */
30
    public function testExceptionWhileConstruction(): void
31
    {
32
        // setup and test body
33
        ob_start();
34
        new ExceptionTestingService(new TestingTransport(new MockProvider()));
35
        $content = ob_get_contents();
36
        ob_end_clean();
37
38
        // assertions
39
        $this->assertStringContainsString("message", $content);
40
        $this->assertStringContainsString("code", $content);
41
        $this->assertTrue(is_array(json_decode($content, true)));
42
    }
43
}
44