예제 #1
0
 /**
  * Loads a root package file from a file path.
  *
  * If the file does not exist, an empty configuration is returned.
  *
  * @param string $path       The path to the package configuration file.
  * @param Config $baseConfig The configuration that the package will inherit
  *                           its configuration values from.
  *
  * @return RootPackageFile The loaded package file.
  *
  * @throws StorageException            If the file cannot be read.
  * @throws InvalidConfigException      If the file contains invalid
  *                                     configuration.
  * @throws UnsupportedVersionException If the version of the package file
  *                                     is not supported.
  */
 public function loadRootPackageFile($path, Config $baseConfig)
 {
     if (!$this->storage->exists($path)) {
         return new RootPackageFile(null, $path, $baseConfig);
     }
     $serialized = $this->storage->read($path);
     return $this->serializer->unserializeRootPackageFile($serialized, $path, $baseConfig);
 }
예제 #2
0
 public function testExists()
 {
     $this->assertTrue($this->storage->exists($this->path));
     unlink($this->path);
     $this->assertFalse($this->storage->exists($this->path));
 }