getFilePath() public method

Get cached file.
public getFilePath ( ) : string
return string
Esempio n. 1
0
 /**
  * Get translations.
  *
  * @return array|mixed
  */
 public function getTranslations()
 {
     // File cached path
     $filePath = $this->compiler->getFilePath();
     // If the file exists
     if (file_exists($filePath)) {
         // Check if is not expired
         if (!$this->compiler->isExpired()) {
             // Return the cached file in
             // an array
             return json_decode(file_get_contents($filePath));
         }
     }
     return $this->cacheFromConfig();
 }
 /** @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);
 }