Completed
Push — master ( a40ed3...30c58f )
by butschster
23s queued 19s
created

SnapshotTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSnapshot() 0 12 2
A testStringConfigParams() 0 9 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Framework;
13
14
use Spiral\Snapshots\SnapshotInterface;
15
use Spiral\Snapshots\SnapshotterInterface;
16
17
class SnapshotTest extends BaseTest
18
{
19
    public function testStringConfigParams()
20
    {
21
        // string important. Emulating string from .env
22
        $app = $this->makeApp([
23
            'SNAPSHOT_MAX_FILES' => '1',
24
            'SNAPSHOT_VERBOSITY' => '1'
25
        ]);
26
27
        $this->assertInstanceOf(SnapshotterInterface::class, $app->get(SnapshotterInterface::class));
28
    }
29
30
    public function testSnapshot(): void
31
    {
32
        $app = $this->makeApp();
33
34
        try {
35
            throw new \Error('test error');
36
        } catch (\Error $e) {
37
            /** @var SnapshotInterface $s */
38
            $s = $app->get(SnapshotterInterface::class)->register($e);
39
        }
40
41
        $this->assertInstanceOf(\Error::class, $s->getException());
42
    }
43
}
44