Chris@0
|
1 <?php
|
Chris@0
|
2 namespace Composer\Installers\Test;
|
Chris@0
|
3
|
Chris@0
|
4 use Composer\Installers\Installer;
|
Chris@0
|
5 use Composer\Util\Filesystem;
|
Chris@0
|
6 use Composer\Package\Package;
|
Chris@0
|
7 use Composer\Package\RootPackage;
|
Chris@0
|
8 use Composer\Composer;
|
Chris@0
|
9 use Composer\Config;
|
Chris@0
|
10
|
Chris@0
|
11 class InstallerTest extends TestCase
|
Chris@0
|
12 {
|
Chris@0
|
13 private $composer;
|
Chris@0
|
14 private $config;
|
Chris@0
|
15 private $vendorDir;
|
Chris@0
|
16 private $binDir;
|
Chris@0
|
17 private $dm;
|
Chris@0
|
18 private $repository;
|
Chris@0
|
19 private $io;
|
Chris@0
|
20 private $fs;
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * setUp
|
Chris@0
|
24 *
|
Chris@0
|
25 * @return void
|
Chris@0
|
26 */
|
Chris@0
|
27 public function setUp()
|
Chris@0
|
28 {
|
Chris@0
|
29 $this->fs = new Filesystem;
|
Chris@0
|
30
|
Chris@0
|
31 $this->composer = new Composer();
|
Chris@0
|
32 $this->config = new Config();
|
Chris@0
|
33 $this->composer->setConfig($this->config);
|
Chris@0
|
34
|
Chris@0
|
35 $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor';
|
Chris@0
|
36 $this->ensureDirectoryExistsAndClear($this->vendorDir);
|
Chris@0
|
37
|
Chris@0
|
38 $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin';
|
Chris@0
|
39 $this->ensureDirectoryExistsAndClear($this->binDir);
|
Chris@0
|
40
|
Chris@0
|
41 $this->config->merge(array(
|
Chris@0
|
42 'config' => array(
|
Chris@0
|
43 'vendor-dir' => $this->vendorDir,
|
Chris@0
|
44 'bin-dir' => $this->binDir,
|
Chris@0
|
45 ),
|
Chris@0
|
46 ));
|
Chris@0
|
47
|
Chris@0
|
48 $this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager')
|
Chris@0
|
49 ->disableOriginalConstructor()
|
Chris@0
|
50 ->getMock();
|
Chris@0
|
51 $this->composer->setDownloadManager($this->dm);
|
Chris@0
|
52
|
Chris@0
|
53 $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
Chris@0
|
54 $this->io = $this->getMock('Composer\IO\IOInterface');
|
Chris@0
|
55 }
|
Chris@0
|
56
|
Chris@0
|
57 /**
|
Chris@0
|
58 * tearDown
|
Chris@0
|
59 *
|
Chris@0
|
60 * @return void
|
Chris@0
|
61 */
|
Chris@0
|
62 public function tearDown()
|
Chris@0
|
63 {
|
Chris@0
|
64 $this->fs->removeDirectory($this->vendorDir);
|
Chris@0
|
65 $this->fs->removeDirectory($this->binDir);
|
Chris@0
|
66 }
|
Chris@0
|
67
|
Chris@0
|
68 /**
|
Chris@0
|
69 * testSupports
|
Chris@0
|
70 *
|
Chris@0
|
71 * @return void
|
Chris@0
|
72 *
|
Chris@0
|
73 * @dataProvider dataForTestSupport
|
Chris@0
|
74 */
|
Chris@0
|
75 public function testSupports($type, $expected)
|
Chris@0
|
76 {
|
Chris@0
|
77 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
78 $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type));
|
Chris@0
|
79 }
|
Chris@0
|
80
|
Chris@0
|
81 /**
|
Chris@0
|
82 * dataForTestSupport
|
Chris@0
|
83 */
|
Chris@0
|
84 public function dataForTestSupport()
|
Chris@0
|
85 {
|
Chris@0
|
86 return array(
|
Chris@0
|
87 array('agl-module', true),
|
Chris@0
|
88 array('aimeos-extension', true),
|
Chris@0
|
89 array('annotatecms-module', true),
|
Chris@0
|
90 array('annotatecms-component', true),
|
Chris@0
|
91 array('annotatecms-service', true),
|
Chris@0
|
92 array('attogram-module', true),
|
Chris@0
|
93 array('bitrix-module', true),
|
Chris@0
|
94 array('bitrix-component', true),
|
Chris@0
|
95 array('bitrix-theme', true),
|
Chris@0
|
96 array('bonefish-package', true),
|
Chris@0
|
97 array('cakephp', false),
|
Chris@0
|
98 array('cakephp-', false),
|
Chris@0
|
99 array('cakephp-app', false),
|
Chris@0
|
100 array('cakephp-plugin', true),
|
Chris@0
|
101 array('chef-cookbook', true),
|
Chris@0
|
102 array('chef-role', true),
|
Chris@0
|
103 array('cockpit-module', true),
|
Chris@0
|
104 array('codeigniter-app', false),
|
Chris@0
|
105 array('codeigniter-library', true),
|
Chris@0
|
106 array('codeigniter-third-party', true),
|
Chris@0
|
107 array('codeigniter-module', true),
|
Chris@0
|
108 array('concrete5-block', true),
|
Chris@0
|
109 array('concrete5-package', true),
|
Chris@0
|
110 array('concrete5-theme', true),
|
Chris@0
|
111 array('concrete5-core', true),
|
Chris@0
|
112 array('concrete5-update', true),
|
Chris@0
|
113 array('craft-plugin', true),
|
Chris@0
|
114 array('croogo-plugin', true),
|
Chris@0
|
115 array('croogo-theme', true),
|
Chris@0
|
116 array('decibel-app', true),
|
Chris@0
|
117 array('dokuwiki-plugin', true),
|
Chris@0
|
118 array('dokuwiki-template', true),
|
Chris@0
|
119 array('drupal-module', true),
|
Chris@0
|
120 array('dolibarr-module', true),
|
Chris@0
|
121 array('ee3-theme', true),
|
Chris@0
|
122 array('ee3-addon', true),
|
Chris@0
|
123 array('ee2-theme', true),
|
Chris@0
|
124 array('ee2-addon', true),
|
Chris@0
|
125 array('elgg-plugin', true),
|
Chris@0
|
126 array('eliasis-module', true),
|
Chris@0
|
127 array('ezplatform-assets', true),
|
Chris@0
|
128 array('ezplatform-meta-assets', true),
|
Chris@0
|
129 array('fuel-module', true),
|
Chris@0
|
130 array('fuel-package', true),
|
Chris@0
|
131 array('fuel-theme', true),
|
Chris@0
|
132 array('fuelphp-component', true),
|
Chris@0
|
133 array('hurad-plugin', true),
|
Chris@0
|
134 array('hurad-theme', true),
|
Chris@0
|
135 array('imagecms-template', true),
|
Chris@0
|
136 array('imagecms-module', true),
|
Chris@0
|
137 array('imagecms-library', true),
|
Chris@0
|
138 array('itop-extension', true),
|
Chris@0
|
139 array('joomla-library', true),
|
Chris@0
|
140 array('kanboard-plugin', true),
|
Chris@0
|
141 array('kirby-plugin', true),
|
Chris@0
|
142 array('kohana-module', true),
|
Chris@0
|
143 array('lms-plugin', true),
|
Chris@0
|
144 array('lms-template', true),
|
Chris@0
|
145 array('lms-document-template', true),
|
Chris@0
|
146 array('lms-userpanel-module', true),
|
Chris@0
|
147 array('laravel-library', true),
|
Chris@0
|
148 array('lavalite-theme', true),
|
Chris@0
|
149 array('lavalite-package', true),
|
Chris@0
|
150 array('lithium-library', true),
|
Chris@0
|
151 array('magento-library', true),
|
Chris@0
|
152 array('mako-package', true),
|
Chris@0
|
153 array('modxevo-snippet', true),
|
Chris@0
|
154 array('modxevo-plugin', true),
|
Chris@0
|
155 array('modxevo-module', true),
|
Chris@0
|
156 array('modxevo-template', true),
|
Chris@0
|
157 array('modxevo-lib', true),
|
Chris@0
|
158 array('mediawiki-extension', true),
|
Chris@0
|
159 array('mediawiki-skin', true),
|
Chris@0
|
160 array('microweber-module', true),
|
Chris@0
|
161 array('modulework-module', true),
|
Chris@0
|
162 array('moodle-mod', true),
|
Chris@0
|
163 array('october-module', true),
|
Chris@0
|
164 array('october-plugin', true),
|
Chris@0
|
165 array('piwik-plugin', true),
|
Chris@0
|
166 array('phpbb-extension', true),
|
Chris@0
|
167 array('pimcore-plugin', true),
|
Chris@0
|
168 array('plentymarkets-plugin', true),
|
Chris@0
|
169 array('ppi-module', true),
|
Chris@0
|
170 array('prestashop-module', true),
|
Chris@0
|
171 array('prestashop-theme', true),
|
Chris@0
|
172 array('puppet-module', true),
|
Chris@0
|
173 array('porto-container', true),
|
Chris@0
|
174 array('radphp-bundle', true),
|
Chris@0
|
175 array('redaxo-addon', true),
|
Chris@0
|
176 array('redaxo-bestyle-plugin', true),
|
Chris@0
|
177 array('reindex-theme', true),
|
Chris@0
|
178 array('reindex-plugin', true),
|
Chris@0
|
179 array('roundcube-plugin', true),
|
Chris@0
|
180 array('shopware-backend-plugin', true),
|
Chris@0
|
181 array('shopware-core-plugin', true),
|
Chris@0
|
182 array('shopware-frontend-plugin', true),
|
Chris@0
|
183 array('shopware-theme', true),
|
Chris@0
|
184 array('shopware-plugin', true),
|
Chris@0
|
185 array('shopware-frontend-theme', true),
|
Chris@0
|
186 array('silverstripe-module', true),
|
Chris@0
|
187 array('silverstripe-theme', true),
|
Chris@0
|
188 array('smf-module', true),
|
Chris@0
|
189 array('smf-theme', true),
|
Chris@0
|
190 array('sydes-module', true),
|
Chris@0
|
191 array('sydes-theme', true),
|
Chris@0
|
192 array('symfony1-plugin', true),
|
Chris@0
|
193 array('thelia-module', true),
|
Chris@0
|
194 array('thelia-frontoffice-template', true),
|
Chris@0
|
195 array('thelia-backoffice-template', true),
|
Chris@0
|
196 array('thelia-email-template', true),
|
Chris@0
|
197 array('tusk-task', true),
|
Chris@0
|
198 array('tusk-asset', true),
|
Chris@0
|
199 array('typo3-flow-plugin', true),
|
Chris@0
|
200 array('typo3-cms-extension', true),
|
Chris@0
|
201 array('userfrosting-sprinkle', true),
|
Chris@0
|
202 array('vanilla-plugin', true),
|
Chris@0
|
203 array('vanilla-theme', true),
|
Chris@0
|
204 array('whmcs-gateway', true),
|
Chris@0
|
205 array('wolfcms-plugin', true),
|
Chris@0
|
206 array('wordpress-plugin', true),
|
Chris@0
|
207 array('wordpress-core', false),
|
Chris@0
|
208 array('yawik-module', true),
|
Chris@0
|
209 array('zend-library', true),
|
Chris@0
|
210 array('zikula-module', true),
|
Chris@0
|
211 array('zikula-theme', true),
|
Chris@0
|
212 array('kodicms-plugin', true),
|
Chris@0
|
213 array('kodicms-media', true),
|
Chris@0
|
214 array('phifty-bundle', true),
|
Chris@0
|
215 array('phifty-library', true),
|
Chris@0
|
216 array('phifty-framework', true),
|
Chris@0
|
217 array('osclass-plugin', true),
|
Chris@0
|
218 array('osclass-theme', true),
|
Chris@0
|
219 array('osclass-language', true),
|
Chris@0
|
220 );
|
Chris@0
|
221 }
|
Chris@0
|
222
|
Chris@0
|
223 /**
|
Chris@0
|
224 * testInstallPath
|
Chris@0
|
225 *
|
Chris@0
|
226 * @dataProvider dataForTestInstallPath
|
Chris@0
|
227 */
|
Chris@0
|
228 public function testInstallPath($type, $path, $name, $version = '1.0.0')
|
Chris@0
|
229 {
|
Chris@0
|
230 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
231 $package = new Package($name, $version, $version);
|
Chris@0
|
232
|
Chris@0
|
233 $package->setType($type);
|
Chris@0
|
234 $result = $installer->getInstallPath($package);
|
Chris@0
|
235 $this->assertEquals($path, $result);
|
Chris@0
|
236 }
|
Chris@0
|
237
|
Chris@0
|
238 /**
|
Chris@0
|
239 * dataFormTestInstallPath
|
Chris@0
|
240 */
|
Chris@0
|
241 public function dataForTestInstallPath()
|
Chris@0
|
242 {
|
Chris@0
|
243 return array(
|
Chris@0
|
244 array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
|
Chris@0
|
245 array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
|
Chris@0
|
246 array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
|
Chris@0
|
247 array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
|
Chris@0
|
248 array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
|
Chris@0
|
249 array('attogram-module', 'modules/my_module/', 'author/my_module'),
|
Chris@0
|
250 array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'),
|
Chris@0
|
251 array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'),
|
Chris@0
|
252 array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'),
|
Chris@0
|
253 array('bitrix-d7-module', 'bitrix/modules/author.my_module/', 'author/my_module'),
|
Chris@0
|
254 array('bitrix-d7-component', 'bitrix/components/author/my_component/', 'author/my_component'),
|
Chris@0
|
255 array('bitrix-d7-template', 'bitrix/templates/author_my_template/', 'author/my_template'),
|
Chris@0
|
256 array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
|
Chris@0
|
257 array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
|
Chris@0
|
258 array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
|
Chris@0
|
259 array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
|
Chris@0
|
260 array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
|
Chris@0
|
261 array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
|
Chris@0
|
262 array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
|
Chris@0
|
263 array('concrete5-block', 'application/blocks/concrete5_block/', 'remo/concrete5_block'),
|
Chris@0
|
264 array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
|
Chris@0
|
265 array('concrete5-theme', 'application/themes/concrete5_theme/', 'remo/concrete5_theme'),
|
Chris@0
|
266 array('concrete5-core', 'concrete/', 'concrete5/core'),
|
Chris@0
|
267 array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
|
Chris@0
|
268 array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
|
Chris@0
|
269 array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
|
Chris@0
|
270 array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'),
|
Chris@0
|
271 array('decibel-app', 'app/someapp/', 'author/someapp'),
|
Chris@0
|
272 array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'),
|
Chris@0
|
273 array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'),
|
Chris@0
|
274 array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'),
|
Chris@0
|
275 array('drupal-module', 'modules/my_module/', 'shama/my_module'),
|
Chris@0
|
276 array('drupal-theme', 'themes/my_module/', 'shama/my_module'),
|
Chris@0
|
277 array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
|
Chris@0
|
278 array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
|
Chris@0
|
279 array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
|
Chris@0
|
280 array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
|
Chris@0
|
281 array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
|
Chris@0
|
282 array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
|
Chris@0
|
283 array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
|
Chris@0
|
284 array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'),
|
Chris@0
|
285 array('ezplatform-assets', 'web/assets/ezplatform/ezplatform_comp/', 'author/ezplatform_comp'),
|
Chris@0
|
286 array('ezplatform-meta-assets', 'web/assets/ezplatform/', 'author/ezplatform_comp'),
|
Chris@0
|
287 array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'),
|
Chris@0
|
288 array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'),
|
Chris@0
|
289 array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'),
|
Chris@0
|
290 array('fuelphp-component', 'components/demo/', 'fuelphp/demo'),
|
Chris@0
|
291 array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'),
|
Chris@0
|
292 array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'),
|
Chris@0
|
293 array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
|
Chris@0
|
294 array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
295 array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
|
Chris@0
|
296 array('itop-extension', 'extensions/my_extension/', 'shama/my_extension'),
|
Chris@0
|
297 array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
298 array('kanboard-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
299 array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
300 array('kohana-module', 'modules/my_package/', 'shama/my_package'),
|
Chris@0
|
301 array('lms-plugin', 'plugins/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
302 array('lms-plugin', 'plugins/MyPackage/', 'shama/my_package'),
|
Chris@0
|
303 array('lms-template', 'templates/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
304 array('lms-template', 'templates/MyPackage/', 'shama/my_package'),
|
Chris@0
|
305 array('lms-document-template', 'documents/templates/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
306 array('lms-document-template', 'documents/templates/MyPackage/', 'shama/my_package'),
|
Chris@0
|
307 array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
308 array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/my_package'),
|
Chris@0
|
309 array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
|
Chris@0
|
310 array('lavalite-theme', 'public/themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
311 array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
|
Chris@0
|
312 array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
|
Chris@0
|
313 array('magento-library', 'lib/foo/', 'test/foo'),
|
Chris@0
|
314 array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
|
Chris@0
|
315 array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
316 array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
317 array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'),
|
Chris@0
|
318 array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
|
Chris@0
|
319 array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
|
Chris@0
|
320 array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
|
Chris@0
|
321 array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
|
Chris@0
|
322 array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
|
Chris@0
|
323 array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'),
|
Chris@0
|
324 array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'),
|
Chris@0
|
325 array('mediawiki-skin', 'skins/someskin/', 'author/someskin'),
|
Chris@0
|
326 array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'),
|
Chris@0
|
327 array('modulework-module', 'modules/my_package/', 'shama/my_package'),
|
Chris@0
|
328 array('moodle-mod', 'mod/my_package/', 'shama/my_package'),
|
Chris@0
|
329 array('october-module', 'modules/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
330 array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
331 array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
332 array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
|
Chris@0
|
333 array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
|
Chris@0
|
334 array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
|
Chris@0
|
335 array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
|
Chris@0
|
336 array('phpbb-style', 'styles/foo/', 'test/foo'),
|
Chris@0
|
337 array('phpbb-language', 'language/foo/', 'test/foo'),
|
Chris@0
|
338 array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'),
|
Chris@0
|
339 array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
|
Chris@0
|
340 array('ppi-module', 'modules/foo/', 'test/foo'),
|
Chris@0
|
341 array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
|
Chris@0
|
342 array('porto-container', 'app/Containers/container-name/', 'test/container-name'),
|
Chris@0
|
343 array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
|
Chris@0
|
344 array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
345 array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
346 array('reindex-theme', 'themes/my_module/', 'author/my_module'),
|
Chris@0
|
347 array('reindex-plugin', 'plugins/my_module/', 'author/my_module'),
|
Chris@0
|
348 array('roundcube-plugin', 'plugins/base/', 'test/base'),
|
Chris@0
|
349 array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'),
|
Chris@0
|
350 array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'),
|
Chris@0
|
351 array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'),
|
Chris@0
|
352 array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'),
|
Chris@0
|
353 array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'),
|
Chris@0
|
354 array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'),
|
Chris@0
|
355 array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'),
|
Chris@0
|
356 array('silverstripe-module', 'my_module/', 'shama/my_module'),
|
Chris@0
|
357 array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'),
|
Chris@0
|
358 array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'),
|
Chris@0
|
359 array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'),
|
Chris@0
|
360 array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'),
|
Chris@0
|
361 array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
362 array('smf-module', 'Sources/my_module/', 'shama/my_module'),
|
Chris@0
|
363 array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
364 array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'),
|
Chris@0
|
365 array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'),
|
Chris@0
|
366 array('thelia-module', 'local/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
367 array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'),
|
Chris@0
|
368 array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'),
|
Chris@0
|
369 array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'),
|
Chris@0
|
370 array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'),
|
Chris@0
|
371 array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'),
|
Chris@0
|
372 array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'),
|
Chris@0
|
373 array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'),
|
Chris@0
|
374 array('userfrosting-sprinkle', 'app/sprinkles/my_sprinkle/', 'shama/my_sprinkle'),
|
Chris@0
|
375 array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
376 array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
377 array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'),
|
Chris@0
|
378 array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
379 array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
380 array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
381 array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
|
Chris@0
|
382 array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
|
Chris@0
|
383 array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
|
Chris@0
|
384 array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
|
Chris@0
|
385 array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
386 array('phifty-bundle', 'bundles/core/', 'shama/core'),
|
Chris@0
|
387 array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'),
|
Chris@0
|
388 array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'),
|
Chris@0
|
389 array('yawik-module', 'module/MyModule/', 'shama/my_module'),
|
Chris@0
|
390 array('osclass-plugin', 'oc-content/plugins/sample_plugin/', 'test/sample_plugin'),
|
Chris@0
|
391 array('osclass-theme', 'oc-content/themes/sample_theme/', 'test/sample_theme'),
|
Chris@0
|
392 array('osclass-language', 'oc-content/languages/sample_lang/', 'test/sample_lang'),
|
Chris@0
|
393 );
|
Chris@0
|
394 }
|
Chris@0
|
395
|
Chris@0
|
396 /**
|
Chris@0
|
397 * testGetCakePHPInstallPathException
|
Chris@0
|
398 *
|
Chris@0
|
399 * @return void
|
Chris@0
|
400 *
|
Chris@0
|
401 * @expectedException \InvalidArgumentException
|
Chris@0
|
402 */
|
Chris@0
|
403 public function testGetCakePHPInstallPathException()
|
Chris@0
|
404 {
|
Chris@0
|
405 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
406 $package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
Chris@0
|
407
|
Chris@0
|
408 $package->setType('cakephp-whoops');
|
Chris@0
|
409 $result = $installer->getInstallPath($package);
|
Chris@0
|
410 }
|
Chris@0
|
411
|
Chris@0
|
412 /**
|
Chris@0
|
413 * testCustomInstallPath
|
Chris@0
|
414 */
|
Chris@0
|
415 public function testCustomInstallPath()
|
Chris@0
|
416 {
|
Chris@0
|
417 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
418 $package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
Chris@0
|
419 $package->setType('cakephp-plugin');
|
Chris@0
|
420 $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
Chris@0
|
421 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
422 $consumerPackage->setExtra(array(
|
Chris@0
|
423 'installer-paths' => array(
|
Chris@0
|
424 'my/custom/path/{$name}/' => array(
|
Chris@0
|
425 'shama/ftp',
|
Chris@0
|
426 'foo/bar',
|
Chris@0
|
427 ),
|
Chris@0
|
428 ),
|
Chris@0
|
429 ));
|
Chris@0
|
430 $result = $installer->getInstallPath($package);
|
Chris@0
|
431 $this->assertEquals('my/custom/path/Ftp/', $result);
|
Chris@0
|
432 }
|
Chris@0
|
433
|
Chris@0
|
434 /**
|
Chris@0
|
435 * testCustomInstallerName
|
Chris@0
|
436 */
|
Chris@0
|
437 public function testCustomInstallerName()
|
Chris@0
|
438 {
|
Chris@0
|
439 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
440 $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
|
Chris@0
|
441 $package->setType('cakephp-plugin');
|
Chris@0
|
442 $package->setExtra(array(
|
Chris@0
|
443 'installer-name' => 'FTP',
|
Chris@0
|
444 ));
|
Chris@0
|
445 $result = $installer->getInstallPath($package);
|
Chris@0
|
446 $this->assertEquals('Plugin/FTP/', $result);
|
Chris@0
|
447 }
|
Chris@0
|
448
|
Chris@0
|
449 /**
|
Chris@0
|
450 * testCustomTypePath
|
Chris@0
|
451 */
|
Chris@0
|
452 public function testCustomTypePath()
|
Chris@0
|
453 {
|
Chris@0
|
454 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
455 $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0');
|
Chris@0
|
456 $package->setType('wordpress-plugin');
|
Chris@0
|
457 $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
Chris@0
|
458 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
459 $consumerPackage->setExtra(array(
|
Chris@0
|
460 'installer-paths' => array(
|
Chris@0
|
461 'my/custom/path/{$name}/' => array(
|
Chris@0
|
462 'type:wordpress-plugin'
|
Chris@0
|
463 ),
|
Chris@0
|
464 ),
|
Chris@0
|
465 ));
|
Chris@0
|
466 $result = $installer->getInstallPath($package);
|
Chris@0
|
467 $this->assertEquals('my/custom/path/my_plugin/', $result);
|
Chris@0
|
468 }
|
Chris@0
|
469
|
Chris@0
|
470 /**
|
Chris@0
|
471 * testVendorPath
|
Chris@0
|
472 */
|
Chris@0
|
473 public function testVendorPath()
|
Chris@0
|
474 {
|
Chris@0
|
475 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
476 $package = new Package('penyaskito/my_module', '1.0.0', '1.0.0');
|
Chris@0
|
477 $package->setType('drupal-module');
|
Chris@0
|
478 $consumerPackage = new RootPackage('drupal/drupal', '1.0.0', '1.0.0');
|
Chris@0
|
479 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
480 $consumerPackage->setExtra(array(
|
Chris@0
|
481 'installer-paths' => array(
|
Chris@0
|
482 'modules/custom/{$name}/' => array(
|
Chris@0
|
483 'vendor:penyaskito'
|
Chris@0
|
484 ),
|
Chris@0
|
485 ),
|
Chris@0
|
486 ));
|
Chris@0
|
487 $result = $installer->getInstallPath($package);
|
Chris@0
|
488 $this->assertEquals('modules/custom/my_module/', $result);
|
Chris@0
|
489 }
|
Chris@0
|
490
|
Chris@0
|
491 /**
|
Chris@0
|
492 * testNoVendorName
|
Chris@0
|
493 */
|
Chris@0
|
494 public function testNoVendorName()
|
Chris@0
|
495 {
|
Chris@0
|
496 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
497 $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0');
|
Chris@0
|
498
|
Chris@0
|
499 $package->setType('symfony1-plugin');
|
Chris@0
|
500 $result = $installer->getInstallPath($package);
|
Chris@0
|
501 $this->assertEquals('plugins/sfPhpunitPlugin/', $result);
|
Chris@0
|
502 }
|
Chris@0
|
503
|
Chris@0
|
504 /**
|
Chris@0
|
505 * testTypo3Inflection
|
Chris@0
|
506 */
|
Chris@0
|
507 public function testTypo3Inflection()
|
Chris@0
|
508 {
|
Chris@0
|
509 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
510 $package = new Package('typo3/fluid', '1.0.0', '1.0.0');
|
Chris@0
|
511
|
Chris@0
|
512 $package->setAutoload(array(
|
Chris@0
|
513 'psr-0' => array(
|
Chris@0
|
514 'TYPO3\\Fluid' => 'Classes',
|
Chris@0
|
515 ),
|
Chris@0
|
516 ));
|
Chris@0
|
517
|
Chris@0
|
518 $package->setType('typo3-flow-package');
|
Chris@0
|
519 $result = $installer->getInstallPath($package);
|
Chris@0
|
520 $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result);
|
Chris@0
|
521 }
|
Chris@0
|
522
|
Chris@0
|
523 public function testUninstallAndDeletePackageFromLocalRepo()
|
Chris@0
|
524 {
|
Chris@0
|
525 $package = new Package('foo', '1.0.0', '1.0.0');
|
Chris@0
|
526
|
Chris@0
|
527 $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
|
Chris@0
|
528 $installer->expects($this->once())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
|
Chris@0
|
529
|
Chris@0
|
530 $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
Chris@0
|
531 $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
|
Chris@0
|
532 $repo->expects($this->once())->method('removePackage')->with($package);
|
Chris@0
|
533
|
Chris@0
|
534 $installer->uninstall($repo, $package);
|
Chris@0
|
535 }
|
Chris@0
|
536 }
|