@@ 40-64 (lines=25) @@ | ||
37 | /** |
|
38 | * Take really last log. |
|
39 | */ |
|
40 | public function testLastLog() |
|
41 | { |
|
42 | /** @var LogService $service */ |
|
43 | $service = $this->container->get(LogService::class); |
|
44 | ||
45 | $this->assertEmpty($service->lastLog()); |
|
46 | ||
47 | $snapshot = $this->makeSnapshot('error', 123); |
|
48 | $snapshot->report(); |
|
49 | ||
50 | /** @var LogFile $last */ |
|
51 | $last = $service->lastLog(); |
|
52 | ||
53 | $this->assertNotEmpty($last); |
|
54 | $this->assertInstanceOf(LogFile::class, $last); |
|
55 | ||
56 | sleep(1); |
|
57 | $this->get('/controller/action'); |
|
58 | ||
59 | /** @var LogFile $last2 */ |
|
60 | $last2 = $service->lastLog(); |
|
61 | $this->assertNotEmpty($last2); |
|
62 | ||
63 | $this->assertNotEquals($last->name(), $last2->name()); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Get log by name is really what we want |
|
@@ 69-89 (lines=21) @@ | ||
66 | /** |
|
67 | * Get log by name is really what we want |
|
68 | */ |
|
69 | public function testGetLogByName() |
|
70 | { |
|
71 | /** @var LogService $service */ |
|
72 | $service = $this->container->get(LogService::class); |
|
73 | ||
74 | $snapshot = $this->makeSnapshot('error', 123); |
|
75 | $snapshot->report(); |
|
76 | ||
77 | $this->assertEmpty($service->getLogByName('some-name')); |
|
78 | ||
79 | /** @var LogFile $last */ |
|
80 | $last = $service->lastLog(); |
|
81 | $this->assertNotEmpty($last); |
|
82 | ||
83 | $log = $service->getLogByName($last->name()); |
|
84 | ||
85 | $this->assertNotEmpty($log); |
|
86 | $this->assertInstanceOf(LogFile::class, $log); |
|
87 | ||
88 | $this->assertEquals($last->name(), $log->name()); |
|
89 | } |
|
90 | ||
91 | /** |
|
92 | * Remove all logs |