/**
* 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']);
}