| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | abstract class AbstractCollectorTestCase extends TestCase |
||
| 12 | { |
||
| 13 | public function testCollect(): void |
||
| 14 | { |
||
| 15 | $indexData = null; |
||
| 16 | $collector = $this->getCollector(); |
||
| 17 | |||
| 18 | $collector->startup(); |
||
| 19 | $this->collectTestData($collector); |
||
| 20 | $data = $collector->getCollected(); |
||
| 21 | if ($collector instanceof IndexCollectorInterface) { |
||
| 22 | $indexData = $collector->getIndexData(); |
||
| 23 | } |
||
| 24 | $collector->shutdown(); |
||
| 25 | |||
| 26 | $this->assertSame($collector::class, $collector->getName()); |
||
| 27 | $this->checkCollectedData($data); |
||
| 28 | if ($collector instanceof IndexCollectorInterface) { |
||
| 29 | $this->checkIndexData($indexData); |
||
|
|
|||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | abstract protected function getCollector(): CollectorInterface; |
||
| 34 | |||
| 35 | abstract protected function collectTestData(CollectorInterface $collector): void; |
||
| 36 | |||
| 37 | protected function checkCollectedData(array $data): void |
||
| 38 | { |
||
| 39 | $this->assertNotEmpty($data); |
||
| 40 | } |
||
| 41 | |||
| 42 | protected function checkIndexData(array $data): void |
||
| 45 | } |
||
| 46 | } |
||
| 47 |