Cache compiler for translations I got part of the code from the view compiler of laravel :)
 /** @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);
 }
Beispiel #2
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;
 }