|
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
|
|
|
|