Esempio n. 1
0
 /**
  * @param string                $workingDir
  * @param PackageInterface|null $package
  *
  * @return string
  */
 public function locate($workingDir, PackageInterface $package = null)
 {
     $defaultPath = $workingDir . DIRECTORY_SEPARATOR . self::APP_CONFIG_FILE;
     $defaultPath = $this->locateConfigFileWithDistSupport($defaultPath);
     if (null !== $package) {
         $defaultPath = $this->useConfigPathFromComposer($package, $defaultPath);
     }
     // Make sure to set the full path when it is declared relative
     // This will fix some issues in windows.
     if (!$this->filesystem->isAbsolutePath($defaultPath)) {
         $defaultPath = $workingDir . DIRECTORY_SEPARATOR . $defaultPath;
     }
     return $defaultPath;
 }
Esempio n. 2
0
 function it_should_locate_config_file_on_empty_composer_configuration(Filesystem $filesystem, PackageInterface $package)
 {
     $package->getExtra()->willReturn([]);
     $filesystem->exists($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $filesystem->isAbsolutePath($this->pathArgument('/composer/grumphp.yml'))->willReturn(true);
     $this->locate('/composer', $package)->shouldMatch($this->pathRegex('/composer/grumphp.yml'));
 }