| @@ 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->assertEmpty($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()); |
|
| 34 | $this->assertInstanceOf(LogFile::class, $log); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Take really last log. |
|
| @@ 93-111 (lines=19) @@ | ||
| 90 | /** |
|
| 91 | * Remove all logs |
|
| 92 | */ |
|
| 93 | public function testRemoveAll() |
|
| 94 | { |
|
| 95 | /** @var LogService $service */ |
|
| 96 | $service = $this->container->get(LogService::class); |
|
| 97 | ||
| 98 | $this->assertEmpty($service->getLogs()); |
|
| 99 | ||
| 100 | $snapshot = $this->makeSnapshot('error', 123); |
|
| 101 | $snapshot->report(); |
|
| 102 | ||
| 103 | $this->assertCount(1, $service->getLogs()); |
|
| 104 | ||
| 105 | $this->get('/controller/action'); |
|
| 106 | $this->assertCount(2, $service->getLogs()); |
|
| 107 | ||
| 108 | $service->removeAll(); |
|
| 109 | ||
| 110 | $this->assertEmpty($service->getLogs()); |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * Remove |
|