Composer\Installers\CakePHPInstaller::getLocations PHP Метод

getLocations() публичный Метод

Change the default plugin location when cakephp >= 3.0
public getLocations ( )
    public function getLocations()
    {
        if ($this->matchesCakeVersion('>=', '3.0.0')) {
            $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
        }
        return $this->locations;
    }

Usage Example

 /**
  * Test getLocations returning appropriate values based on CakePHP version
  *
  */
 public function testGetLocations()
 {
     $package = new RootPackage('CamelCased', '1.0', '1.0');
     $composer = $this->composer;
     $rm = new RepositoryManager($this->getMock('Composer\\IO\\IOInterface'), $this->getMock('Composer\\Config'));
     $composer->setRepositoryManager($rm);
     $installer = new CakePHPInstaller($package, $composer);
     // 2.0 < cakephp < 3.0
     $this->setCakephpVersion($rm, '2.0.0');
     $result = $installer->getLocations();
     $this->assertContains('Plugin/', $result['plugin']);
     $this->setCakephpVersion($rm, '2.5.9');
     $result = $installer->getLocations();
     $this->assertContains('Plugin/', $result['plugin']);
     $this->setCakephpVersion($rm, '~2.5');
     $result = $installer->getLocations();
     $this->assertContains('Plugin/', $result['plugin']);
     // special handling for 2.x versions when 3.x is still in development
     $this->setCakephpVersion($rm, 'dev-master');
     $result = $installer->getLocations();
     $this->assertContains('Plugin/', $result['plugin']);
     $this->setCakephpVersion($rm, '>=2.5');
     $result = $installer->getLocations();
     $this->assertContains('Plugin/', $result['plugin']);
     // cakephp >= 3.0
     $this->setCakephpVersion($rm, '3.0.*-dev');
     $result = $installer->getLocations();
     $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
     $this->setCakephpVersion($rm, '~8.8');
     $result = $installer->getLocations();
     $this->assertContains('vendor/{$vendor}/{$name}/', $result['plugin']);
 }