private function getEntry($extension) { $entry = $this->list[$extension]; if ($this->context->hasCache() && !$entry instanceof CachedProcessor) { $this->list[$extension] = new CachedProcessor($entry, $this->cache, $this->fileSystem); } return $this->list[$extension]; }
/** * @test */ public function unserialize_success() { $context = new Context(); $context->enableDebug(true); $entry = new CacheBinderEntry(); $entry->setContext($context); $entry->setMimeType('text/css'); $result = $this->target->unserialize($entry->serialize()); $this->assertEquals('text/css', $result->getMimeType()); $this->assertTrue($result->getContext()->hasDebug()); $this->assertFalse($result->getContext()->hasMinifier()); }
private function createRuntimeComment($runtime) { if ($this->context->hasStopWatch()) { return sprintf(self::COMMENT_TIMING, $runtime); } return ''; }
/** * @test */ public function bind_successContextChanged() { $file = 'example.file'; $time = new DateTime(); $iterator = $this->stubBinderAndCache($file, 'Lorem Ipsum', 'cached', $time, $time); $this->context->enableDebug(true); $this->assertBind($iterator, 'Lorem Ipsum'); $this->assertCacheEntry($iterator, 'Lorem Ipsum', [$file => $time], true); }
/** * @test */ public function unserialize_success() { $input = new Context(); $input->enableDebug(true); $this->target->unserialize($input->serialize()); $this->assertTrue($this->target->hasDebug()); }
public function transformContext() { $context = new Context(); $string = $this->get(self::DATA_CONTEXT); $this->set(self::DATA_CONTEXT, is_null($string) ? $context : $context->unserialize($string)); }
/** * @param $key * @return string */ public function getFilePath($key) { return $this->context->getCachePath() . sprintf(self::FILENAME_FORMAT, md5($key)); }
/** * @inheritdoc */ public function setCachePath($path = null) { $this->context->setCachePath($path); return $this; }