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

SnapshotTest::testStringConfigParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
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