/** * @test */ public function getIterator_success() { $expected = ['assets/css/file1.css', 'assets/css/file2.css']; $this->fileSystem->setGlob('assets/css/*.css', $expected); $this->target->add('assets/css/*.css'); $result = $this->target->getIterator(); $this->assertNotEmpty($result); $this->assertContains('assets/css/file1.css', $result); $this->assertContains('assets/css/file2.css', $result); }
/** * @test */ public function deleteEntry_success() { $key = '/path/file.txt'; $path = $this->target->getFilePath($key); $this->fileSystem->setExists($path); $this->target->deleteEntry($key); $this->assertTrue($this->fileSystem->hasDeleted($path)); }
/** * @test */ public function getFiles_successFromCache() { $file = 'example.file'; $time = new DateTime(); $iterator = new FileList([$file]); $this->fileSystem->setModifiedTime($file, $time); $this->setCache($iterator, 'cached', [$file => $time]); $this->executeBind($iterator); $this->assertNotEmpty($this->target->getFiles()); $this->assertArrayHasKey($file, $this->target->getFiles()); }
/** * @test */ public function getIterator_successWithGlobStarFiles() { $this->fileSystem->setGlob('modules/*/', ['modules/Accordion/', 'modules/Example/']); $this->fileSystem->setGlob('modules/*/*/', ['modules/Accordion/css/', 'modules/Example/css/']); $this->fileSystem->setGlob('modules/*/*/*/', []); $this->fileSystem->setGlob('modules/*/css/*.css', ['modules/Example/css/example.css']); $this->fileSystem->setGlob('modules/*/*/css/*.css', []); $this->target->add('modules/**/css/*.css'); $result = $this->target->getIterator(); $this->assertNotEmpty($result); $this->assertCount(1, $result); $this->assertContains('modules/Example/css/example.css', $result); }
protected function assertProcess($expected, $current, $file = 'example.file') { $this->fileSystem->setContent($file, $current); $this->assertEquals($expected, $this->target->process($file)); }
private function stubFile($file, $content, $time) { $this->fileSystem->setModifiedTime($file, $time); $this->stubProcessor($file, $content, $time, [$file => $time]); }