public function CakePHPInstallerTest::testGetLocations in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php \Composer\Installers\Test\CakePHPInstallerTest::testGetLocations()
Test getLocations returning appropriate values based on CakePHP version
File
- vendor/
composer/ installers/ tests/ Composer/ Installers/ Test/ CakePHPInstallerTest.php, line 64
Class
Namespace
Composer\Installers\TestCode
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
->assertEquals('vendor/{$vendor}/{$name}/', $result['plugin']);
}