| Total Complexity | 4 | 
| Total Lines | 46 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 13 | final class FileStorageTest extends AbstractStorageTest | ||
| 14 | { | ||
| 15 | private string $path = __DIR__ . '/runtime'; | ||
| 16 | |||
| 17 | protected function tearDown(): void | ||
| 18 |     { | ||
| 19 | parent::tearDown(); | ||
| 20 | FileHelper::removeDirectory($this->path); | ||
| 21 | } | ||
| 22 | |||
| 23 | /** | ||
| 24 | * @dataProvider dataProvider() | ||
| 25 | */ | ||
| 26 | public function testFlushWithGC(array $data): void | ||
| 27 |     { | ||
| 28 | $idGenerator = new DebuggerIdGenerator(); | ||
| 29 | $storage = $this->getStorage($idGenerator); | ||
| 30 | $storage->setHistorySize(5); | ||
| 31 | $collector = $this->createFakeCollector($data); | ||
| 32 | |||
| 33 | $storage->addCollector($collector); | ||
| 34 | $storage->flush(); | ||
| 35 | $this->assertLessThanOrEqual(5, count($storage->read())); | ||
| 36 | } | ||
| 37 | |||
| 38 | /** | ||
| 39 | * @dataProvider dataProvider() | ||
| 40 | */ | ||
| 41 | public function testClear(array $data): void | ||
| 42 |     { | ||
| 43 | $idGenerator = new DebuggerIdGenerator(); | ||
| 44 | $storage = $this->getStorage($idGenerator); | ||
| 45 | $collector = $this->createFakeCollector($data); | ||
| 46 | |||
| 47 | $storage->addCollector($collector); | ||
| 48 | $storage->flush(); | ||
| 49 | $storage->clear(); | ||
| 50 | $this->assertDirectoryDoesNotExist($this->path); | ||
| 51 | } | ||
| 52 | |||
| 53 | public function getStorage(DebuggerIdGenerator $idGenerator): StorageInterface | ||
| 59 | ); | ||
| 60 | } | ||
| 61 | } | ||
| 62 |