private function setCache($iterator, $value, $files) { $key = $this->target->generateCacheKey($iterator); $entry = new CacheBinderEntry($value, $files, new DateTime()); $entry->setMimeType('text/css'); $entry->setContext(new Context()); $this->cache->setHas($key); $this->cache->setEntry($key, $entry->serialize()); }
/** * @test */ public function process_successInternalFileChangedCache() { $file1 = 'example1.file'; $file2 = 'example2.file'; $time = new DateTime(); $newTime = (new DateTime())->setTimestamp($time->getTimestamp() + 42); $entry1 = $this->stubCacheEntry('cached1', $file1, $time); $this->stubFile($file1, 'content', $time); $this->target->process($file1); $entry2 = $this->stubCacheEntry('cached2', $file2, $time, [$file2 => $time, $file1 => $time]); $this->stubFile($file1, 'content', $newTime); $this->stubFile($file2, 'content', $time); $this->assertEquals('cached2', $this->target->process($file2)); $this->assertEquals($entry1->serialize(), $this->cache->getEntry($file1)); $this->assertEquals($entry2->serialize(), $this->cache->getEntry($file2)); }