cacheFile() public method

Cache the file in json format.
public cacheFile ( array $contents ) : boolean | integer
$contents array
return boolean | integer
Esempio n. 1
0
 /**
  * Get the translations from the
  * array of the config file and it
  * will cache them.
  *
  * @return array
  */
 protected function cacheFromConfig()
 {
     // If is expire then I retrieve directly the array
     $fileTranslation = $this->config->get('notifynder.translations');
     // I put the edited content in the cached file
     $this->compiler->cacheFile($fileTranslation);
     // return the translations
     return $fileTranslation;
 }
 /** @test */
 function it_get_the_translations_from_never_cached_config_file(Compiler $compiler, Repository $config)
 {
     $filePath = 'cached/file';
     $translations = [];
     $compiler->getFilePath()->shouldBeCalled()->willReturn($filePath);
     $config->get('notifynder.translations')->shouldBeCalled()->willReturn($translations);
     $compiler->cacheFile($translations)->shouldBeCalled();
     $this->getTranslations()->shouldReturn($translations);
 }