Passed
Pull Request — master (#407)
by Kirill
06:59
created

TestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUriParser() 0 7 2
A notice() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Tests\Storage;
6
7
use PHPUnit\Framework\TestCase as BaseTestCase;
8
use Spiral\Storage\Parser\UriParser;
9
use Spiral\Storage\Parser\UriParserInterface;
10
11
class TestCase extends BaseTestCase
12
{
13
    /**
14
     * @var string
15
     */
16
    protected const SERVER_NAME = 'debugServer';
17
18
    /**
19
     * @var string
20
     */
21
    protected const VFS_PREFIX = 'vfs://';
22
23
    /**
24
     * @var string
25
     */
26
    protected const ROOT_DIR = __DIR__ . '/storage/testRoot';
27
28
    /**
29
     * @var string
30
     */
31
    protected const CONFIG_HOST = 'http://localhost/debug/';
32
33
    /**
34
     * @var UriParserInterface|null
35
     */
36
    protected $uriParser;
37
38
    /**
39
     * @return UriParserInterface
40
     */
41
    protected function getUriParser(): UriParserInterface
42
    {
43
        if (!$this->uriParser instanceof UriParserInterface) {
44
            $this->uriParser = new UriParser();
45
        }
46
47
        return $this->uriParser;
48
    }
49
50
    /**
51
     * @param string $message
52
     */
53
    protected function notice(string $message): void
54
    {
55
        if (\method_exists($this, 'addWarning')) {
56
            /** @psalm-suppress InternalMethod */
57
            $this->addWarning($message);
58
        }
59
    }
60
}
61