Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function load($resource, $type = null)
 {
     if (!$this->filesystem->exists($resource)) {
         throw new \InvalidArgumentException(sprintf('Given theme metadata file "%s" does not exists!', $resource));
     }
     $themeData = $this->transformResourceContentsToArray($this->filesystem->getFileContents($resource));
     $theme = $this->themeFactory->createFromArray($themeData);
     $theme->setPath(substr($resource, 0, strrpos($resource, '/')));
     return $theme;
 }
 /**
  * @param string $path
  */
 private function assertFileExists($path)
 {
     if (!$this->filesystem->exists($path)) {
         throw new \InvalidArgumentException(sprintf('Given file "%s" does not exist!', $path));
     }
 }
 function it_throws_exception_if_given_file_does_not_exist(FilesystemInterface $filesystem)
 {
     $filesystem->exists('/non/existent/path/60861204')->willReturn(false);
     $this->shouldThrow('\\InvalidArgumentException')->duringLoad('/non/existent/path/60861204');
 }
 function it_throws_an_exception_if_file_does_not_exist(FilesystemInterface $filesystem)
 {
     $filesystem->exists('composer.json')->willReturn(false);
     $this->shouldThrow(\InvalidArgumentException::class)->during('load', ['composer.json']);
 }