/**
  * @param string $templateIdentifier
  * @param \Closure $templateSourceClosure Closure which returns the template source if needed
  * @return ParsedTemplateInterface
  */
 protected function getOrParseAndStoreTemplate($templateIdentifier, $templateSourceClosure)
 {
     if ($this->templateCompiler->has($templateIdentifier)) {
         $parsedTemplate = $this->templateCompiler->get($templateIdentifier);
     } else {
         $parsedTemplate = $this->templateParser->parse($templateSourceClosure($this, $this->templatePaths));
         if ($parsedTemplate->isCompilable()) {
             $this->templateCompiler->store($templateIdentifier, $parsedTemplate);
         }
     }
     return $parsedTemplate;
 }
 /**
  * @test
  */
 public function testStoreWhenDisabledFlushesCache()
 {
     $cache = $this->getMock('NamelessCoder\\Fluid\\Core\\Cache\\SimpleFileCache', array('flush', 'store'));
     $cache->expects($this->never())->method('store');
     $cache->expects($this->once())->method('flush')->with('fakeidentifier');
     $state = new ParsingState();
     $instance = new TemplateCompiler();
     $instance->disable();
     $instance->setTemplateCache($cache);
     $instance->store('fakeidentifier', $state);
 }