/**
  * Initialize the installed package.
  */
 private function initInstalledPackages()
 {
     /* @var PackageInterface $package */
     foreach ($this->installedRepository->getPackages() as $package) {
         $operator = $this->getFilterOperator($package);
         /* @var Link $link */
         $link = current($this->versionParser->parseLinks($this->package->getName(), $this->package->getVersion(), 'installed', array($package->getName() => $operator . $package->getPrettyVersion())));
         $link = $this->includeRootConstraint($package, $link);
         $this->requires[$package->getName()] = $link;
     }
 }
 /**
  * Init test.
  *
  * @param array  $requires
  * @param string $minimumStability
  * @param array  $extra
  */
 protected function init(array $requires = array(), $minimumStability = 'stable', array $extra = array())
 {
     if (method_exists('Composer\\Package\\Loader\\ArrayLoader', 'parseLinks')) {
         $parser = new ArrayLoader();
         $linkRequires = $parser->parseLinks('__ROOT__', '1.0.0', 'requires', $requires);
     } else {
         $parser = new VersionParser();
         $linkRequires = $parser->parseLinks('__ROOT__', '1.0.0', 'requires', $requires);
     }
     $stabilityFlags = $this->findStabilityFlags($requires);
     $this->package->expects($this->any())->method('getRequires')->will($this->returnValue($linkRequires));
     $this->package->expects($this->any())->method('getDevRequires')->will($this->returnValue(array()));
     $this->package->expects($this->any())->method('getMinimumStability')->will($this->returnValue($minimumStability));
     $this->package->expects($this->any())->method('getStabilityFlags')->will($this->returnValue($stabilityFlags));
     $this->package->expects($this->any())->method('getExtra')->will($this->returnValue($extra));
     /* @var RootPackageInterface $package */
     $package = $this->package;
     $this->filter = new VcsPackageFilter($package, $this->installationManager, $this->installedRepository);
 }