Example #1
0
 public function getPlatformRequirements($withDevReqs = false)
 {
     $lockData = $this->getLockData();
     $versionParser = new VersionParser();
     $requirements = array();
     if (!empty($lockData['platform'])) {
         $requirements = $versionParser->parseLinks('__ROOT__', '1.0.0', 'requires', isset($lockData['platform']) ? $lockData['platform'] : array());
     }
     if ($withDevReqs && !empty($lockData['platform-dev'])) {
         $devRequirements = $versionParser->parseLinks('__ROOT__', '1.0.0', 'requires', isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array());
         $requirements = array_merge($requirements, $devRequirements);
     }
     return $requirements;
 }
 public function testPluginApiVersionDoesSupportSelfVersion()
 {
     $parser = new VersionParser();
     /** @var Link[] $links */
     $links = $parser->parseLinks('Plugin', '6.6.6', '', array('composer-plugin-api' => 'self.version'));
     $this->assertArrayHasKey('composer-plugin-api', $links);
     $this->assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString());
 }
    protected function init(array $requires = array(), $minimumStability = 'stable')
    {
        $parser = new VersionParser();
        $linkRequires = $parser->parseLinks('__ROOT__', '1.0.0', 'requires', $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));

        /* @var RootPackageInterface $package */
        $package = $this->package;
        $this->filter = new VcsPackageFilter($package);
    }