Passed
Push — master ( e24ab0...9e1161 )
by Kirill
03:14
created

SnapshotTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSnapshot() 0 21 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\Snapshots;
13
14
use PHPUnit\Framework\TestCase;
15
use Spiral\Snapshots\Snapshot;
16
17
class SnapshotTest extends TestCase
18
{
19
    public function testSnapshot()
20
    {
21
        $e = new \Error("message");
22
        $s = new Snapshot("id", $e);
23
24
        $this->assertSame("id", $s->getID());
25
        $this->assertSame($e, $s->getException());
26
27
        $this->assertStringContainsString("Error", $s->getMessage());
28
        $this->assertStringContainsString("message", $s->getMessage());
29
        $this->assertStringContainsString(__FILE__, $s->getMessage());
30
        $this->assertStringContainsString("21", $s->getMessage());
31
32
        $description = $s->describe();
33
        $this->assertStringContainsString("Error", $description['error']);
34
        $this->assertStringContainsString("message", $description['error']);
35
        $this->assertStringContainsString(__FILE__, $description['error']);
36
        $this->assertStringContainsString("21", $description['error']);
37
38
        $this->assertSame(__FILE__, $description['location']['file']);
39
        $this->assertSame(21, $description['location']['line']);
40
    }
41
}
42