init
This commit is contained in:
80
vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php
vendored
Normal file
80
vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\AsgardInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AsgardInstallerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var AsgardInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new AsgardInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
array('name' => $expected, 'type' => $type),
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
// Should keep module name StudlyCase
|
||||
array(
|
||||
'asgard-module',
|
||||
'user-profile',
|
||||
'UserProfile'
|
||||
),
|
||||
array(
|
||||
'asgard-module',
|
||||
'asgard-module',
|
||||
'Asgard'
|
||||
),
|
||||
array(
|
||||
'asgard-module',
|
||||
'blog',
|
||||
'Blog'
|
||||
),
|
||||
// tests that exactly one '-module' is cut off
|
||||
array(
|
||||
'asgard-module',
|
||||
'some-module-module',
|
||||
'SomeModule',
|
||||
),
|
||||
// tests that exactly one '-theme' is cut off
|
||||
array(
|
||||
'asgard-theme',
|
||||
'some-theme-theme',
|
||||
'SomeTheme',
|
||||
),
|
||||
// tests that names without '-theme' suffix stay valid
|
||||
array(
|
||||
'asgard-theme',
|
||||
'someothertheme',
|
||||
'Someothertheme',
|
||||
),
|
||||
// Should keep theme name StudlyCase
|
||||
array(
|
||||
'asgard-theme',
|
||||
'adminlte-advanced',
|
||||
'AdminlteAdvanced'
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
75
vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php
vendored
Normal file
75
vendor/composer/installers/tests/Composer/Installers/Test/BitrixInstallerTest.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\BitrixInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
|
||||
/**
|
||||
* Tests for the BitrixInstaller Class
|
||||
*
|
||||
* @coversDefaultClass Composer\Installers\BitrixInstaller
|
||||
*/
|
||||
class BitrixInstallerTest extends TestCase
|
||||
{
|
||||
/** @var BitrixInstaller */
|
||||
private $installer;
|
||||
|
||||
/** @var Composer */
|
||||
private $composer;
|
||||
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, instantiate the class-under-test.
|
||||
*
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
final function setUp()
|
||||
{
|
||||
$this->composer = new Composer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $vars
|
||||
* @param string $expectedVars
|
||||
*
|
||||
* @covers ::inflectPackageVars
|
||||
*
|
||||
* @dataProvider provideExpectedInflectionResults
|
||||
*/
|
||||
final public function testInflectPackageVars($vars, $expectedVars)
|
||||
{
|
||||
|
||||
$this->installer = new BitrixInstaller(
|
||||
new Package($vars['name'], '4.2', '4.2'),
|
||||
$this->composer
|
||||
);
|
||||
$actual = $this->installer->inflectPackageVars($vars);
|
||||
$this->assertEquals($actual, $expectedVars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides various parameters for packages and the expected result after inflection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function provideExpectedInflectionResults()
|
||||
{
|
||||
return array(
|
||||
//check bitrix-dir is correct
|
||||
array(
|
||||
array('name' => 'Nyan/Cat'),
|
||||
array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix')
|
||||
),
|
||||
array(
|
||||
array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix'),
|
||||
array('name' => 'Nyan/Cat', 'bitrix_dir' => 'bitrix')
|
||||
),
|
||||
array(
|
||||
array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local'),
|
||||
array('name' => 'Nyan/Cat', 'bitrix_dir' => 'local')
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
114
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php
vendored
Normal file
114
vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\CakePHPInstaller;
|
||||
use Composer\Repository\RepositoryManager;
|
||||
use Composer\Repository\InstalledArrayRepository;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\RootPackage;
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Composer;
|
||||
use Composer\Config;
|
||||
|
||||
class CakePHPInstallerTest extends TestCase
|
||||
{
|
||||
private $composer;
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->package = new Package('CamelCased', '1.0', '1.0');
|
||||
$this->io = $this->getMock('Composer\IO\PackageInterface');
|
||||
$this->composer = new Composer();
|
||||
$this->composer->setConfig(new Config(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectPackageVars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectPackageVars()
|
||||
{
|
||||
$installer = new CakePHPInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
|
||||
$this->assertEquals($result, array('name' => 'CamelCased'));
|
||||
|
||||
$installer = new CakePHPInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'with-dash'));
|
||||
$this->assertEquals($result, array('name' => 'WithDash'));
|
||||
|
||||
$installer = new CakePHPInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
|
||||
$this->assertEquals($result, array('name' => 'WithUnderscore'));
|
||||
|
||||
$installer = new CakePHPInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'cake/acl'));
|
||||
$this->assertEquals($result, array('name' => 'Cake/Acl'));
|
||||
|
||||
$installer = new CakePHPInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'cake/debug-kit'));
|
||||
$this->assertEquals($result, array('name' => 'Cake/DebugKit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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']);
|
||||
}
|
||||
|
||||
protected function setCakephpVersion($rm, $version) {
|
||||
$parser = new VersionParser();
|
||||
list(, $version) = explode(' ', $parser->parseConstraints($version));
|
||||
$installed = new InstalledArrayRepository();
|
||||
$package = new Package('cakephp/cakephp', $version, $version);
|
||||
$installed->addPackage($package);
|
||||
$rm->setLocalRepository($installed);
|
||||
}
|
||||
|
||||
}
|
||||
83
vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php
vendored
Normal file
83
vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\CraftInstaller;
|
||||
|
||||
/**
|
||||
* Tests for the CraftInstaller Class
|
||||
*
|
||||
* @coversDefaultClass Composer\Installers\CraftInstaller
|
||||
*/
|
||||
class CraftInstallerTest extends TestCase
|
||||
{
|
||||
/** @var CraftInstaller */
|
||||
private $installer;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, instantiate the class-under-test.
|
||||
*
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
final public function setup()
|
||||
{
|
||||
$this->installer = new CraftInstaller();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @param string $expectedName
|
||||
*
|
||||
* @covers ::inflectPackageVars
|
||||
*
|
||||
* @dataProvider provideExpectedInflectionResults
|
||||
*/
|
||||
final public function testInflectPackageVars($packageName, $expectedName)
|
||||
{
|
||||
$installer = $this->installer;
|
||||
|
||||
$vars = array('name' => $packageName);
|
||||
$expected = array('name' => $expectedName);
|
||||
|
||||
$actual = $installer->inflectPackageVars($vars);
|
||||
|
||||
$this->assertEquals($actual, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides various names for packages and the expected result after inflection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final public function provideExpectedInflectionResults()
|
||||
{
|
||||
return array(
|
||||
// lowercase
|
||||
array('foo', 'foo'),
|
||||
array('craftfoo', 'craftfoo'),
|
||||
array('fooplugin', 'fooplugin'),
|
||||
array('craftfooplugin', 'craftfooplugin'),
|
||||
// lowercase - dash
|
||||
array('craft-foo', 'foo'),
|
||||
array('foo-plugin', 'foo'),
|
||||
array('craft-foo-plugin', 'foo'),
|
||||
// lowercase - underscore
|
||||
array('craft_foo', 'craft_foo'),
|
||||
array('foo_plugin', 'foo_plugin'),
|
||||
array('craft_foo_plugin', 'craft_foo_plugin'),
|
||||
// CamelCase
|
||||
array('Foo', 'Foo'),
|
||||
array('CraftFoo', 'CraftFoo'),
|
||||
array('FooPlugin', 'FooPlugin'),
|
||||
array('CraftFooPlugin', 'CraftFooPlugin'),
|
||||
// CamelCase - Dash
|
||||
array('Craft-Foo', 'Foo'),
|
||||
array('Foo-Plugin', 'Foo'),
|
||||
array('Craft-Foo-Plugin', 'Foo'),
|
||||
// CamelCase - underscore
|
||||
array('Craft_Foo', 'Craft_Foo'),
|
||||
array('Foo_Plugin', 'Foo_Plugin'),
|
||||
array('Craft_Foo_Plugin', 'Craft_Foo_Plugin'),
|
||||
);
|
||||
}
|
||||
}
|
||||
90
vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php
vendored
Normal file
90
vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\DokuWikiInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class DokuWikiInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var DokuWikiInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new DokuWikiInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
|
||||
array('name' => $expected, 'type'=>$type)
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'dokuwiki-plugin',
|
||||
'dokuwiki-test-plugin',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-plugin',
|
||||
'test-plugin',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-plugin',
|
||||
'dokuwiki_test',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-plugin',
|
||||
'test',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-plugin',
|
||||
'test-template',
|
||||
'test-template',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-template',
|
||||
'dokuwiki-test-template',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-template',
|
||||
'test-template',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-template',
|
||||
'dokuwiki_test',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-template',
|
||||
'test',
|
||||
'test',
|
||||
),
|
||||
array(
|
||||
'dokuwiki-template',
|
||||
'test-plugin',
|
||||
'test-plugin',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
63
vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php
vendored
Normal file
63
vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Installers\GravInstaller;
|
||||
|
||||
class GravInstallerTest extends TestCase
|
||||
{
|
||||
/* @var \Composer\Composer */
|
||||
protected $composer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->composer = new Composer();
|
||||
}
|
||||
|
||||
public function testInflectPackageVars()
|
||||
{
|
||||
$package = $this->getPackage('vendor/name', '0.0.0');
|
||||
$installer = new GravInstaller($package, $this->composer);
|
||||
$packageVars = $this->getPackageVars($package);
|
||||
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => 'test')));
|
||||
$this->assertEquals('test', $result['name']);
|
||||
|
||||
foreach ($installer->getLocations() as $name => $location) {
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test")));
|
||||
$this->assertEquals('test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-$name")));
|
||||
$this->assertEquals('test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test-test")));
|
||||
$this->assertEquals('test-test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-test-$name")));
|
||||
$this->assertEquals('test-test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test")));
|
||||
$this->assertEquals('test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-$name")));
|
||||
$this->assertEquals('test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test-test")));
|
||||
$this->assertEquals('test-test', $result['name']);
|
||||
$result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-test-$name")));
|
||||
$this->assertEquals('test-test', $result['name']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $package \Composer\Package\PackageInterface
|
||||
*/
|
||||
public function getPackageVars($package)
|
||||
{
|
||||
$type = $package->getType();
|
||||
|
||||
$prettyName = $package->getPrettyName();
|
||||
if (strpos($prettyName, '/') !== false) {
|
||||
list($vendor, $name) = explode('/', $prettyName);
|
||||
} else {
|
||||
$vendor = '';
|
||||
$name = $prettyName;
|
||||
}
|
||||
|
||||
return compact('name', 'vendor', 'type');
|
||||
}
|
||||
}
|
||||
552
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php
vendored
Normal file
552
vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php
vendored
Normal file
@@ -0,0 +1,552 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\Installer;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\RootPackage;
|
||||
use Composer\Composer;
|
||||
use Composer\Config;
|
||||
|
||||
class InstallerTest extends TestCase
|
||||
{
|
||||
private $composer;
|
||||
private $config;
|
||||
private $vendorDir;
|
||||
private $binDir;
|
||||
private $dm;
|
||||
private $repository;
|
||||
private $io;
|
||||
private $fs;
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->fs = new Filesystem;
|
||||
|
||||
$this->composer = new Composer();
|
||||
$this->config = new Config();
|
||||
$this->composer->setConfig($this->config);
|
||||
|
||||
$this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor';
|
||||
$this->ensureDirectoryExistsAndClear($this->vendorDir);
|
||||
|
||||
$this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin';
|
||||
$this->ensureDirectoryExistsAndClear($this->binDir);
|
||||
|
||||
$this->config->merge(array(
|
||||
'config' => array(
|
||||
'vendor-dir' => $this->vendorDir,
|
||||
'bin-dir' => $this->binDir,
|
||||
),
|
||||
));
|
||||
|
||||
$this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->composer->setDownloadManager($this->dm);
|
||||
|
||||
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
||||
$this->io = $this->getMock('Composer\IO\IOInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
$this->fs->removeDirectory($this->vendorDir);
|
||||
$this->fs->removeDirectory($this->binDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSupports
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @dataProvider dataForTestSupport
|
||||
*/
|
||||
public function testSupports($type, $expected)
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* dataForTestSupport
|
||||
*/
|
||||
public function dataForTestSupport()
|
||||
{
|
||||
return array(
|
||||
array('agl-module', true),
|
||||
array('aimeos-extension', true),
|
||||
array('annotatecms-module', true),
|
||||
array('annotatecms-component', true),
|
||||
array('annotatecms-service', true),
|
||||
array('attogram-module', true),
|
||||
array('bitrix-module', true),
|
||||
array('bitrix-component', true),
|
||||
array('bitrix-theme', true),
|
||||
array('bonefish-package', true),
|
||||
array('cakephp', false),
|
||||
array('cakephp-', false),
|
||||
array('cakephp-app', false),
|
||||
array('cakephp-plugin', true),
|
||||
array('chef-cookbook', true),
|
||||
array('chef-role', true),
|
||||
array('cockpit-module', true),
|
||||
array('codeigniter-app', false),
|
||||
array('codeigniter-library', true),
|
||||
array('codeigniter-third-party', true),
|
||||
array('codeigniter-module', true),
|
||||
array('concrete5-block', true),
|
||||
array('concrete5-package', true),
|
||||
array('concrete5-theme', true),
|
||||
array('concrete5-core', true),
|
||||
array('concrete5-update', true),
|
||||
array('craft-plugin', true),
|
||||
array('croogo-plugin', true),
|
||||
array('croogo-theme', true),
|
||||
array('decibel-app', true),
|
||||
array('dokuwiki-plugin', true),
|
||||
array('dokuwiki-template', true),
|
||||
array('drupal-module', true),
|
||||
array('dolibarr-module', true),
|
||||
array('ee3-theme', true),
|
||||
array('ee3-addon', true),
|
||||
array('ee2-theme', true),
|
||||
array('ee2-addon', true),
|
||||
array('elgg-plugin', true),
|
||||
array('eliasis-component', true),
|
||||
array('eliasis-module', true),
|
||||
array('eliasis-plugin', true),
|
||||
array('eliasis-template', true),
|
||||
array('ezplatform-assets', true),
|
||||
array('ezplatform-meta-assets', true),
|
||||
array('fuel-module', true),
|
||||
array('fuel-package', true),
|
||||
array('fuel-theme', true),
|
||||
array('fuelphp-component', true),
|
||||
array('hurad-plugin', true),
|
||||
array('hurad-theme', true),
|
||||
array('imagecms-template', true),
|
||||
array('imagecms-module', true),
|
||||
array('imagecms-library', true),
|
||||
array('itop-extension', true),
|
||||
array('joomla-library', true),
|
||||
array('kanboard-plugin', true),
|
||||
array('kirby-plugin', true),
|
||||
array('kohana-module', true),
|
||||
array('lms-plugin', true),
|
||||
array('lms-template', true),
|
||||
array('lms-document-template', true),
|
||||
array('lms-userpanel-module', true),
|
||||
array('laravel-library', true),
|
||||
array('lavalite-theme', true),
|
||||
array('lavalite-package', true),
|
||||
array('lithium-library', true),
|
||||
array('magento-library', true),
|
||||
array('majima-plugin', true),
|
||||
array('mako-package', true),
|
||||
array('modx-extra', true),
|
||||
array('modxevo-snippet', true),
|
||||
array('modxevo-plugin', true),
|
||||
array('modxevo-module', true),
|
||||
array('modxevo-template', true),
|
||||
array('modxevo-lib', true),
|
||||
array('mediawiki-extension', true),
|
||||
array('mediawiki-skin', true),
|
||||
array('microweber-module', true),
|
||||
array('modulework-module', true),
|
||||
array('moodle-mod', true),
|
||||
array('october-module', true),
|
||||
array('october-plugin', true),
|
||||
array('piwik-plugin', true),
|
||||
array('pxcms-module', true),
|
||||
array('pxcms-theme', true),
|
||||
array('phpbb-extension', true),
|
||||
array('pimcore-plugin', true),
|
||||
array('plentymarkets-plugin', true),
|
||||
array('ppi-module', true),
|
||||
array('prestashop-module', true),
|
||||
array('prestashop-theme', true),
|
||||
array('puppet-module', true),
|
||||
array('porto-container', true),
|
||||
array('radphp-bundle', true),
|
||||
array('redaxo-addon', true),
|
||||
array('redaxo-bestyle-plugin', true),
|
||||
array('reindex-theme', true),
|
||||
array('reindex-plugin', true),
|
||||
array('roundcube-plugin', true),
|
||||
array('shopware-backend-plugin', true),
|
||||
array('shopware-core-plugin', true),
|
||||
array('shopware-frontend-plugin', true),
|
||||
array('shopware-theme', true),
|
||||
array('shopware-plugin', true),
|
||||
array('shopware-frontend-theme', true),
|
||||
array('silverstripe-module', true),
|
||||
array('silverstripe-theme', true),
|
||||
array('smf-module', true),
|
||||
array('smf-theme', true),
|
||||
array('sydes-module', true),
|
||||
array('sydes-theme', true),
|
||||
array('symfony1-plugin', true),
|
||||
array('thelia-module', true),
|
||||
array('thelia-frontoffice-template', true),
|
||||
array('thelia-backoffice-template', true),
|
||||
array('thelia-email-template', true),
|
||||
array('tusk-task', true),
|
||||
array('tusk-asset', true),
|
||||
array('typo3-flow-plugin', true),
|
||||
array('typo3-cms-extension', true),
|
||||
array('userfrosting-sprinkle', true),
|
||||
array('vanilla-plugin', true),
|
||||
array('vanilla-theme', true),
|
||||
array('whmcs-gateway', true),
|
||||
array('wolfcms-plugin', true),
|
||||
array('wordpress-plugin', true),
|
||||
array('wordpress-core', false),
|
||||
array('yawik-module', true),
|
||||
array('zend-library', true),
|
||||
array('zikula-module', true),
|
||||
array('zikula-theme', true),
|
||||
array('kodicms-plugin', true),
|
||||
array('kodicms-media', true),
|
||||
array('phifty-bundle', true),
|
||||
array('phifty-library', true),
|
||||
array('phifty-framework', true),
|
||||
array('osclass-plugin', true),
|
||||
array('osclass-theme', true),
|
||||
array('osclass-language', true),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInstallPath
|
||||
*
|
||||
* @dataProvider dataForTestInstallPath
|
||||
*/
|
||||
public function testInstallPath($type, $path, $name, $version = '1.0.0')
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package($name, $version, $version);
|
||||
|
||||
$package->setType($type);
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals($path, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* dataFormTestInstallPath
|
||||
*/
|
||||
public function dataForTestInstallPath()
|
||||
{
|
||||
return array(
|
||||
array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
|
||||
array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
|
||||
array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
|
||||
array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
|
||||
array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
|
||||
array('attogram-module', 'modules/my_module/', 'author/my_module'),
|
||||
array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'),
|
||||
array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'),
|
||||
array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'),
|
||||
array('bitrix-d7-module', 'bitrix/modules/author.my_module/', 'author/my_module'),
|
||||
array('bitrix-d7-component', 'bitrix/components/author/my_component/', 'author/my_component'),
|
||||
array('bitrix-d7-template', 'bitrix/templates/author_my_template/', 'author/my_template'),
|
||||
array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
|
||||
array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
|
||||
array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
|
||||
array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
|
||||
array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
|
||||
array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
|
||||
array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
|
||||
array('concrete5-block', 'application/blocks/concrete5_block/', 'remo/concrete5_block'),
|
||||
array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
|
||||
array('concrete5-theme', 'application/themes/concrete5_theme/', 'remo/concrete5_theme'),
|
||||
array('concrete5-core', 'concrete/', 'concrete5/core'),
|
||||
array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
|
||||
array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
|
||||
array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
|
||||
array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'),
|
||||
array('decibel-app', 'app/someapp/', 'author/someapp'),
|
||||
array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'),
|
||||
array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'),
|
||||
array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'),
|
||||
array('drupal-module', 'modules/my_module/', 'shama/my_module'),
|
||||
array('drupal-theme', 'themes/my_module/', 'shama/my_module'),
|
||||
array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
|
||||
array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
|
||||
array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
|
||||
array('eliasis-component', 'components/my_component/', 'shama/my_component'),
|
||||
array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
|
||||
array('eliasis-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('eliasis-template', 'templates/my_template/', 'shama/my_template'),
|
||||
array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
|
||||
array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
|
||||
array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
|
||||
array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'),
|
||||
array('ezplatform-assets', 'web/assets/ezplatform/ezplatform_comp/', 'author/ezplatform_comp'),
|
||||
array('ezplatform-meta-assets', 'web/assets/ezplatform/', 'author/ezplatform_comp'),
|
||||
array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'),
|
||||
array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'),
|
||||
array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'),
|
||||
array('fuelphp-component', 'components/demo/', 'fuelphp/demo'),
|
||||
array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'),
|
||||
array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'),
|
||||
array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
|
||||
array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
|
||||
array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
|
||||
array('itop-extension', 'extensions/my_extension/', 'shama/my_extension'),
|
||||
array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('kanboard-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('kohana-module', 'modules/my_package/', 'shama/my_package'),
|
||||
array('lms-plugin', 'plugins/MyPackage/', 'shama/MyPackage'),
|
||||
array('lms-plugin', 'plugins/MyPackage/', 'shama/my_package'),
|
||||
array('lms-template', 'templates/MyPackage/', 'shama/MyPackage'),
|
||||
array('lms-template', 'templates/MyPackage/', 'shama/my_package'),
|
||||
array('lms-document-template', 'documents/templates/MyPackage/', 'shama/MyPackage'),
|
||||
array('lms-document-template', 'documents/templates/MyPackage/', 'shama/my_package'),
|
||||
array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/MyPackage'),
|
||||
array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/my_package'),
|
||||
array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
|
||||
array('lavalite-theme', 'public/themes/my_theme/', 'shama/my_theme'),
|
||||
array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
|
||||
array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
|
||||
array('magento-library', 'lib/foo/', 'test/foo'),
|
||||
array('majima-plugin', 'plugins/MyPlugin/', 'shama/my-plugin'),
|
||||
array('modx-extra', 'core/packages/extra/', 'vendor/extra'),
|
||||
array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
|
||||
array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
|
||||
array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'),
|
||||
array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
|
||||
array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
|
||||
array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
|
||||
array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
|
||||
array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
|
||||
array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'),
|
||||
array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'),
|
||||
array('mediawiki-skin', 'skins/someskin/', 'author/someskin'),
|
||||
array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'),
|
||||
array('modulework-module', 'modules/my_package/', 'shama/my_package'),
|
||||
array('moodle-mod', 'mod/my_package/', 'shama/my_package'),
|
||||
array('october-module', 'modules/my_plugin/', 'shama/my_plugin'),
|
||||
array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
|
||||
array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
|
||||
array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
|
||||
array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
|
||||
array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
|
||||
array('pxcms-module', 'app/Modules/Foo/', 'vendor/module-foo'),
|
||||
array('pxcms-module', 'app/Modules/Foo/', 'vendor/pxcms-foo'),
|
||||
array('pxcms-theme', 'themes/Foo/', 'vendor/theme-foo'),
|
||||
array('pxcms-theme', 'themes/Foo/', 'vendor/pxcms-foo'),
|
||||
array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
|
||||
array('phpbb-style', 'styles/foo/', 'test/foo'),
|
||||
array('phpbb-language', 'language/foo/', 'test/foo'),
|
||||
array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'),
|
||||
array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
|
||||
array('ppi-module', 'modules/foo/', 'test/foo'),
|
||||
array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
|
||||
array('porto-container', 'app/Containers/container-name/', 'test/container-name'),
|
||||
array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
|
||||
array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
|
||||
array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('reindex-theme', 'themes/my_module/', 'author/my_module'),
|
||||
array('reindex-plugin', 'plugins/my_module/', 'author/my_module'),
|
||||
array('roundcube-plugin', 'plugins/base/', 'test/base'),
|
||||
array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'),
|
||||
array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'),
|
||||
array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'),
|
||||
array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'),
|
||||
array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'),
|
||||
array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'),
|
||||
array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'),
|
||||
array('silverstripe-module', 'my_module/', 'shama/my_module'),
|
||||
array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'),
|
||||
array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'),
|
||||
array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'),
|
||||
array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'),
|
||||
array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'),
|
||||
array('smf-module', 'Sources/my_module/', 'shama/my_module'),
|
||||
array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'),
|
||||
array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'),
|
||||
array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'),
|
||||
array('thelia-module', 'local/modules/my_module/', 'shama/my_module'),
|
||||
array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'),
|
||||
array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'),
|
||||
array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'),
|
||||
array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'),
|
||||
array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'),
|
||||
array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'),
|
||||
array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'),
|
||||
array('userfrosting-sprinkle', 'app/sprinkles/my_sprinkle/', 'shama/my_sprinkle'),
|
||||
array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'),
|
||||
array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'),
|
||||
array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
|
||||
array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
|
||||
array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
|
||||
array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
|
||||
array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
|
||||
array('phifty-bundle', 'bundles/core/', 'shama/core'),
|
||||
array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'),
|
||||
array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'),
|
||||
array('yawik-module', 'module/MyModule/', 'shama/my_module'),
|
||||
array('osclass-plugin', 'oc-content/plugins/sample_plugin/', 'test/sample_plugin'),
|
||||
array('osclass-theme', 'oc-content/themes/sample_theme/', 'test/sample_theme'),
|
||||
array('osclass-language', 'oc-content/languages/sample_lang/', 'test/sample_lang'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetCakePHPInstallPathException
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testGetCakePHPInstallPathException()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
||||
|
||||
$package->setType('cakephp-whoops');
|
||||
$result = $installer->getInstallPath($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomInstallPath
|
||||
*/
|
||||
public function testCustomInstallPath()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
||||
$package->setType('cakephp-plugin');
|
||||
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
||||
$this->composer->setPackage($consumerPackage);
|
||||
$consumerPackage->setExtra(array(
|
||||
'installer-paths' => array(
|
||||
'my/custom/path/{$name}/' => array(
|
||||
'shama/ftp',
|
||||
'foo/bar',
|
||||
),
|
||||
),
|
||||
));
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('my/custom/path/Ftp/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomInstallerName
|
||||
*/
|
||||
public function testCustomInstallerName()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
|
||||
$package->setType('cakephp-plugin');
|
||||
$package->setExtra(array(
|
||||
'installer-name' => 'FTP',
|
||||
));
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('Plugin/FTP/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomTypePath
|
||||
*/
|
||||
public function testCustomTypePath()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0');
|
||||
$package->setType('wordpress-plugin');
|
||||
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
||||
$this->composer->setPackage($consumerPackage);
|
||||
$consumerPackage->setExtra(array(
|
||||
'installer-paths' => array(
|
||||
'my/custom/path/{$name}/' => array(
|
||||
'type:wordpress-plugin'
|
||||
),
|
||||
),
|
||||
));
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('my/custom/path/my_plugin/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testVendorPath
|
||||
*/
|
||||
public function testVendorPath()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('penyaskito/my_module', '1.0.0', '1.0.0');
|
||||
$package->setType('drupal-module');
|
||||
$consumerPackage = new RootPackage('drupal/drupal', '1.0.0', '1.0.0');
|
||||
$this->composer->setPackage($consumerPackage);
|
||||
$consumerPackage->setExtra(array(
|
||||
'installer-paths' => array(
|
||||
'modules/custom/{$name}/' => array(
|
||||
'vendor:penyaskito'
|
||||
),
|
||||
),
|
||||
));
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('modules/custom/my_module/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testNoVendorName
|
||||
*/
|
||||
public function testNoVendorName()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0');
|
||||
|
||||
$package->setType('symfony1-plugin');
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('plugins/sfPhpunitPlugin/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTypo3Inflection
|
||||
*/
|
||||
public function testTypo3Inflection()
|
||||
{
|
||||
$installer = new Installer($this->io, $this->composer);
|
||||
$package = new Package('typo3/fluid', '1.0.0', '1.0.0');
|
||||
|
||||
$package->setAutoload(array(
|
||||
'psr-0' => array(
|
||||
'TYPO3\\Fluid' => 'Classes',
|
||||
),
|
||||
));
|
||||
|
||||
$package->setType('typo3-flow-package');
|
||||
$result = $installer->getInstallPath($package);
|
||||
$this->assertEquals('Packages/Application/TYPO3.Fluid/', $result);
|
||||
}
|
||||
|
||||
public function testUninstallAndDeletePackageFromLocalRepo()
|
||||
{
|
||||
$package = new Package('foo', '1.0.0', '1.0.0');
|
||||
|
||||
$installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
|
||||
$installer->expects($this->atLeastOnce())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
|
||||
|
||||
$repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
||||
$repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
|
||||
$repo->expects($this->once())->method('removePackage')->with($package);
|
||||
|
||||
$installer->uninstall($repo, $package);
|
||||
}
|
||||
}
|
||||
62
vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php
vendored
Normal file
62
vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\MayaInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class MayaInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var MayaInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new MayaInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
array('name' => $expected, 'type' => $type),
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
// Should keep module name StudlyCase
|
||||
array(
|
||||
'maya-module',
|
||||
'user-profile',
|
||||
'UserProfile'
|
||||
),
|
||||
array(
|
||||
'maya-module',
|
||||
'maya-module',
|
||||
'Maya'
|
||||
),
|
||||
array(
|
||||
'maya-module',
|
||||
'blog',
|
||||
'Blog'
|
||||
),
|
||||
// tests that exactly one '-module' is cut off
|
||||
array(
|
||||
'maya-module',
|
||||
'some-module-module',
|
||||
'SomeModule',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
67
vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php
vendored
Normal file
67
vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\MediaWikiInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class MediaWikiInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var MediaWikiInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new MediaWikiInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
|
||||
array('name' => $expected, 'type'=>$type)
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'mediawiki-extension',
|
||||
'sub-page-list',
|
||||
'SubPageList',
|
||||
),
|
||||
array(
|
||||
'mediawiki-extension',
|
||||
'sub-page-list-extension',
|
||||
'SubPageList',
|
||||
),
|
||||
array(
|
||||
'mediawiki-extension',
|
||||
'semantic-mediawiki',
|
||||
'SemanticMediawiki',
|
||||
),
|
||||
// tests that exactly one '-skin' is cut off, and that skins do not get ucwords treatment like extensions
|
||||
array(
|
||||
'mediawiki-skin',
|
||||
'some-skin-skin',
|
||||
'some-skin',
|
||||
),
|
||||
// tests that names without '-skin' suffix stay valid
|
||||
array(
|
||||
'mediawiki-skin',
|
||||
'someotherskin',
|
||||
'someotherskin',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
67
vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php
vendored
Normal file
67
vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\OctoberInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class OctoberInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var OctoberInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new OctoberInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
|
||||
array('name' => $expected, 'type' => $type)
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'october-plugin',
|
||||
'subpagelist',
|
||||
'subpagelist',
|
||||
),
|
||||
array(
|
||||
'october-plugin',
|
||||
'subpagelist-plugin',
|
||||
'subpagelist',
|
||||
),
|
||||
array(
|
||||
'october-plugin',
|
||||
'semanticoctober',
|
||||
'semanticoctober',
|
||||
),
|
||||
// tests that exactly one '-theme' is cut off
|
||||
array(
|
||||
'october-theme',
|
||||
'some-theme-theme',
|
||||
'some-theme',
|
||||
),
|
||||
// tests that names without '-theme' suffix stay valid
|
||||
array(
|
||||
'october-theme',
|
||||
'someothertheme',
|
||||
'someothertheme',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
84
vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php
vendored
Normal file
84
vendor/composer/installers/tests/Composer/Installers/Test/OntoWikiInstallerTest.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\OntoWikiInstaller;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
/**
|
||||
* Test for the OntoWikiInstaller
|
||||
* code was taken from DokuWikiInstaller
|
||||
*/
|
||||
class OntoWikiInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var OntoWikiInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new OntoWikiInstaller();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)),
|
||||
array('name' => $expected, 'type'=>$type)
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'ontowiki-extension',
|
||||
'CSVImport.ontowiki',
|
||||
'csvimport',
|
||||
),
|
||||
array(
|
||||
'ontowiki-extension',
|
||||
'csvimport',
|
||||
'csvimport',
|
||||
),
|
||||
array(
|
||||
'ontowiki-extension',
|
||||
'some_ontowiki_extension',
|
||||
'some_ontowiki_extension',
|
||||
),
|
||||
array(
|
||||
'ontowiki-extension',
|
||||
'some_ontowiki_extension.ontowiki',
|
||||
'some_ontowiki_extension',
|
||||
),
|
||||
array(
|
||||
'ontowiki-translation',
|
||||
'de-translation.ontowiki',
|
||||
'de',
|
||||
),
|
||||
array(
|
||||
'ontowiki-translation',
|
||||
'en-US-translation.ontowiki',
|
||||
'en-us',
|
||||
),
|
||||
array(
|
||||
'ontowiki-translation',
|
||||
'en-US-translation',
|
||||
'en-us',
|
||||
),
|
||||
array(
|
||||
'ontowiki-theme',
|
||||
'blue-theme.ontowiki',
|
||||
'blue',
|
||||
),
|
||||
array(
|
||||
'ontowiki-theme',
|
||||
'blue-theme',
|
||||
'blue',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
44
vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php
vendored
Normal file
44
vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\PimcoreInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
|
||||
class PimcoreInstallerTest extends TestCase
|
||||
{
|
||||
private $composer;
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->package = new Package('CamelCased', '1.0', '1.0');
|
||||
$this->io = $this->getMock('Composer\IO\PackageInterface');
|
||||
$this->composer = new Composer();
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectPackageVars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectPackageVars()
|
||||
{
|
||||
$installer = new PimcoreInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'CamelCased'));
|
||||
$this->assertEquals($result, array('name' => 'CamelCased'));
|
||||
|
||||
$installer = new PimcoreInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'with-dash'));
|
||||
$this->assertEquals($result, array('name' => 'WithDash'));
|
||||
|
||||
$installer = new PimcoreInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'with_underscore'));
|
||||
$this->assertEquals($result, array('name' => 'WithUnderscore'));
|
||||
}
|
||||
}
|
||||
63
vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php
vendored
Normal file
63
vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Installers\PiwikInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Class PiwikInstallerTest
|
||||
*
|
||||
* @package Composer\Installers\Test
|
||||
*/
|
||||
class PiwikInstallerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @varComposer
|
||||
*/
|
||||
private $composer;
|
||||
|
||||
/**
|
||||
* @var PackageInterface
|
||||
*/
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* @var Package
|
||||
*/
|
||||
private $package;
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->package = new Package('VisitSummary', '1.0', '1.0');
|
||||
$this->io = $this->getMock('Composer\IO\PackageInterface');
|
||||
$this->composer = new Composer();
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectPackageVars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectPackageVars()
|
||||
{
|
||||
$installer = new PiwikInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'VisitSummary'));
|
||||
$this->assertEquals($result, array('name' => 'VisitSummary'));
|
||||
|
||||
$installer = new PiwikInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'visit-summary'));
|
||||
$this->assertEquals($result, array('name' => 'VisitSummary'));
|
||||
|
||||
$installer = new PiwikInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => 'visit_summary'));
|
||||
$this->assertEquals($result, array('name' => 'VisitSummary'));
|
||||
}
|
||||
|
||||
}
|
||||
120
vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php
vendored
Normal file
120
vendor/composer/installers/tests/Composer/Installers/Test/SiteDirectInstallerTest.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Installers\SiteDirectInstaller;
|
||||
use Composer\Package\Package;
|
||||
|
||||
class SiteDirectInstallerTest extends TestCase
|
||||
{
|
||||
/** @var SiteDirectInstaller $installer */
|
||||
protected $installer;
|
||||
|
||||
/** @var Package */
|
||||
private $package;
|
||||
|
||||
public function SetUp()
|
||||
{
|
||||
$this->package = new Package('sitedirect/some_name', '1.0.9', '1.0');
|
||||
$this->installer = new SiteDirectInstaller(
|
||||
$this->package,
|
||||
new Composer()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
public function testInflectPackageVars($data, $expected)
|
||||
{
|
||||
$result = $this->installer->inflectPackageVars($data);
|
||||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
public function testInstallPath($data, $expected)
|
||||
{
|
||||
$result = $this->installer->inflectPackageVars($data);
|
||||
$path = $this->createPackage($data);
|
||||
|
||||
// use $result to get the proper capitalization for the vendor path
|
||||
$expectedPath = "modules/{$result['vendor']}/{$result['name']}/";
|
||||
$notExpectedPath = "modules/{$data['vendor']}/{$data['name']}/";
|
||||
$this->assertEquals($expectedPath, $path);
|
||||
$this->assertNotEquals($notExpectedPath, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
private function createPackage($data)
|
||||
{
|
||||
$fullName = "{$data['vendor']}/{$data['name']}";
|
||||
|
||||
$package = new Package($fullName, '1.0', '1.0');
|
||||
$package->setType('sitedirect-module');
|
||||
$installer = new SiteDirectInstaller($package, new Composer());
|
||||
|
||||
$path = $installer->getInstallPath($package, 'sitedirect');
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function dataProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'data' => array(
|
||||
'name' => 'kernel',
|
||||
'vendor' => 'sitedirect',
|
||||
'type' => 'sitedirect-module',
|
||||
),
|
||||
'expected' => array(
|
||||
'name' => 'Kernel',
|
||||
'vendor' => 'SiteDirect',
|
||||
'type' => 'sitedirect-module',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'data' => array(
|
||||
'name' => 'that_guy',
|
||||
'vendor' => 'whatGuy',
|
||||
'type' => 'sitedirect-module',
|
||||
),
|
||||
'expected' => array(
|
||||
'name' => 'ThatGuy',
|
||||
'vendor' => 'whatGuy',
|
||||
'type' => 'sitedirect-module',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'data' => array(
|
||||
'name' => 'checkout',
|
||||
'vendor' => 'someVendor',
|
||||
'type' => 'sitedirect-plugin',
|
||||
),
|
||||
'expected' => array(
|
||||
'name' => 'Checkout',
|
||||
'vendor' => 'someVendor',
|
||||
'type' => 'sitedirect-plugin',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'data' => array(
|
||||
'name' => 'checkout',
|
||||
'vendor' => 'siteDirect',
|
||||
'type' => 'sitedirect-plugin',
|
||||
),
|
||||
'expected' => array(
|
||||
'name' => 'Checkout',
|
||||
'vendor' => 'SiteDirect',
|
||||
'type' => 'sitedirect-plugin',
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
82
vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php
vendored
Normal file
82
vendor/composer/installers/tests/Composer/Installers/Test/SyDESInstallerTest.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\SyDESInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class SyDESInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var SyDESInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new SyDESInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
array('name' => $expected, 'type' => $type),
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
// modules
|
||||
array(
|
||||
'sydes-module',
|
||||
'name',
|
||||
'Name'
|
||||
),
|
||||
array(
|
||||
'sydes-module',
|
||||
'sample-name',
|
||||
'SampleName'
|
||||
),
|
||||
array(
|
||||
'sydes-module',
|
||||
'sydes-name',
|
||||
'Name'
|
||||
),
|
||||
array(
|
||||
'sydes-module',
|
||||
'sample-name-module',
|
||||
'SampleName',
|
||||
),
|
||||
array(
|
||||
'sydes-module',
|
||||
'sydes-sample-name-module',
|
||||
'SampleName'
|
||||
),
|
||||
// themes
|
||||
array(
|
||||
'sydes-theme',
|
||||
'some-theme-theme',
|
||||
'some-theme',
|
||||
),
|
||||
array(
|
||||
'sydes-theme',
|
||||
'sydes-sometheme',
|
||||
'sometheme',
|
||||
),
|
||||
array(
|
||||
'sydes-theme',
|
||||
'Sample-Name',
|
||||
'sample-name'
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
65
vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php
vendored
Normal file
65
vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Util\Filesystem;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
private static $parser;
|
||||
|
||||
protected static function getVersionParser()
|
||||
{
|
||||
if (!self::$parser) {
|
||||
self::$parser = new VersionParser();
|
||||
}
|
||||
|
||||
return self::$parser;
|
||||
}
|
||||
|
||||
protected function getVersionConstraint($operator, $version)
|
||||
{
|
||||
return new VersionConstraint(
|
||||
$operator,
|
||||
self::getVersionParser()->normalize($version)
|
||||
);
|
||||
}
|
||||
|
||||
protected function getPackage($name, $version)
|
||||
{
|
||||
$normVersion = self::getVersionParser()->normalize($version);
|
||||
|
||||
return new Package($name, $normVersion, $version);
|
||||
}
|
||||
|
||||
protected function getAliasPackage($package, $version)
|
||||
{
|
||||
$normVersion = self::getVersionParser()->normalize($version);
|
||||
|
||||
return new AliasPackage($package, $normVersion, $version);
|
||||
}
|
||||
|
||||
protected function ensureDirectoryExistsAndClear($directory)
|
||||
{
|
||||
$fs = new Filesystem();
|
||||
if (is_dir($directory)) {
|
||||
$fs->removeDirectory($directory);
|
||||
}
|
||||
mkdir($directory, 0777, true);
|
||||
}
|
||||
}
|
||||
80
vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php
vendored
Normal file
80
vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Installers\VgmcpInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Composer;
|
||||
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||
|
||||
class VgmcpInstallerTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @var VgmcpInstaller
|
||||
*/
|
||||
private $installer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->installer = new VgmcpInstaller(
|
||||
new Package('NyanCat', '4.2', '4.2'),
|
||||
new Composer()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider packageNameInflectionProvider
|
||||
*/
|
||||
public function testInflectPackageVars($type, $name, $expected)
|
||||
{
|
||||
$this->assertEquals(
|
||||
array('name' => $expected, 'type' => $type),
|
||||
$this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
|
||||
);
|
||||
}
|
||||
|
||||
public function packageNameInflectionProvider()
|
||||
{
|
||||
return array(
|
||||
// Should keep bundle name StudlyCase
|
||||
array(
|
||||
'vgmcp-bundle',
|
||||
'user-profile',
|
||||
'UserProfile'
|
||||
),
|
||||
array(
|
||||
'vgmcp-bundle',
|
||||
'vgmcp-bundle',
|
||||
'Vgmcp'
|
||||
),
|
||||
array(
|
||||
'vgmcp-bundle',
|
||||
'blog',
|
||||
'Blog'
|
||||
),
|
||||
// tests that exactly one '-bundle' is cut off
|
||||
array(
|
||||
'vgmcp-bundle',
|
||||
'some-bundle-bundle',
|
||||
'SomeBundle',
|
||||
),
|
||||
// tests that exactly one '-theme' is cut off
|
||||
array(
|
||||
'vgmcp-theme',
|
||||
'some-theme-theme',
|
||||
'SomeTheme',
|
||||
),
|
||||
// tests that names without '-theme' suffix stay valid
|
||||
array(
|
||||
'vgmcp-theme',
|
||||
'someothertheme',
|
||||
'Someothertheme',
|
||||
),
|
||||
// Should keep theme name StudlyCase
|
||||
array(
|
||||
'vgmcp-theme',
|
||||
'adminlte-advanced',
|
||||
'AdminlteAdvanced'
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
64
vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php
vendored
Normal file
64
vendor/composer/installers/tests/Composer/Installers/Test/YawikInstallerTest.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace Composer\Installers\Test;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Installers\YawikInstaller;
|
||||
use Composer\Package\Package;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Class YawikInstallerTest
|
||||
*
|
||||
* @package Composer\Installers\Test
|
||||
*/
|
||||
class YawikInstallerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @varComposer
|
||||
*/
|
||||
private $composer;
|
||||
|
||||
/**
|
||||
* @var PackageInterface
|
||||
*/
|
||||
private $io;
|
||||
|
||||
/**
|
||||
* @var Package
|
||||
*/
|
||||
private $package;
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->package = new Package('YawikCompanyRegistration', '1.0', '1.0');
|
||||
$this->io = $this->getMock('Composer\IO\PackageInterface');
|
||||
$this->composer = new Composer();
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectPackageVars
|
||||
*
|
||||
* @dataProvider packageNameProvider
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectPackageVars($input)
|
||||
{
|
||||
$installer = new YawikInstaller($this->package, $this->composer);
|
||||
$result = $installer->inflectPackageVars(array('name' => $input));
|
||||
$this->assertEquals($result, array('name' => 'YawikCompanyRegistration'));
|
||||
}
|
||||
|
||||
public function packageNameProvider()
|
||||
{
|
||||
return array(
|
||||
array('yawik-company-registration'),
|
||||
array('yawik_company_registration'),
|
||||
array('YawikCompanyRegistration')
|
||||
);
|
||||
}
|
||||
}
|
||||
4
vendor/composer/installers/tests/bootstrap.php
vendored
Normal file
4
vendor/composer/installers/tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$loader = require __DIR__ . '/../src/bootstrap.php';
|
||||
$loader->add('Composer\Installers\Test', __DIR__);
|
||||
Reference in New Issue
Block a user