@@ 18-35 (lines=18) @@ | ||
15 | /** |
|
16 | * Can get all logs. |
|
17 | */ |
|
18 | public function testGetLogs() |
|
19 | { |
|
20 | /** @var LogService $service */ |
|
21 | $service = $this->container->get(LogService::class); |
|
22 | ||
23 | $this->assertCount(0, $service->getLogs()); |
|
24 | ||
25 | $snapshot = $this->makeSnapshot('error', 123); |
|
26 | $snapshot->report(); |
|
27 | ||
28 | $this->assertCount(1, $service->getLogs()); |
|
29 | ||
30 | $this->get('/controller/action'); |
|
31 | $this->assertCount(2, $service->getLogs()); |
|
32 | ||
33 | $log = current($service->getLogs()->iterate()); |
|
34 | $this->assertInstanceOf(LogFile::class, $log); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * Take really last log. |
|
@@ 94-112 (lines=19) @@ | ||
91 | /** |
|
92 | * Remove all logs |
|
93 | */ |
|
94 | public function testRemoveAll() |
|
95 | { |
|
96 | /** @var LogService $service */ |
|
97 | $service = $this->container->get(LogService::class); |
|
98 | ||
99 | $this->assertCount(0, $service->getLogs()); |
|
100 | ||
101 | $snapshot = $this->makeSnapshot('error', 123); |
|
102 | $snapshot->report(); |
|
103 | ||
104 | $this->assertCount(1, $service->getLogs()); |
|
105 | ||
106 | $this->get('/controller/action'); |
|
107 | $this->assertCount(2, $service->getLogs()); |
|
108 | ||
109 | $service->removeAll(); |
|
110 | ||
111 | $this->assertEmpty($service->getLogs()); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * Remove |