/** * @covers ::deleteChunks */ public function testFile_deleteChunks() { //// Setup test $this->requestArr['flowTotalChunks'] = 4; $fileInfo = new \ArrayObject(); $request = new Request($this->requestArr, $fileInfo); $file = new File($this->config, $request); $chunkPrefix = sha1($request->getIdentifier()) . '_'; $firstChunk = vfsStream::newFile($chunkPrefix . 1); $this->vfs->addChild($firstChunk); $secondChunk = vfsStream::newFile($chunkPrefix . 3); $this->vfs->addChild($secondChunk); $thirdChunk = vfsStream::newFile('other'); $this->vfs->addChild($thirdChunk); //// Actual test $this->assertTrue(file_exists($firstChunk->url())); $this->assertTrue(file_exists($secondChunk->url())); $this->assertTrue(file_exists($thirdChunk->url())); $file->deleteChunks(); $this->assertFalse(file_exists($firstChunk->url())); $this->assertFalse(file_exists($secondChunk->url())); $this->assertTrue(file_exists($thirdChunk->url())); }