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-component', true),
|
Chris@0
|
127 array('eliasis-module', true),
|
Chris@0
|
128 array('eliasis-plugin', true),
|
Chris@0
|
129 array('eliasis-template', true),
|
Chris@0
|
130 array('ezplatform-assets', true),
|
Chris@0
|
131 array('ezplatform-meta-assets', true),
|
Chris@0
|
132 array('fuel-module', true),
|
Chris@0
|
133 array('fuel-package', true),
|
Chris@0
|
134 array('fuel-theme', true),
|
Chris@0
|
135 array('fuelphp-component', true),
|
Chris@0
|
136 array('hurad-plugin', true),
|
Chris@0
|
137 array('hurad-theme', true),
|
Chris@0
|
138 array('imagecms-template', true),
|
Chris@0
|
139 array('imagecms-module', true),
|
Chris@0
|
140 array('imagecms-library', true),
|
Chris@0
|
141 array('itop-extension', true),
|
Chris@0
|
142 array('joomla-library', true),
|
Chris@0
|
143 array('kanboard-plugin', true),
|
Chris@0
|
144 array('kirby-plugin', true),
|
Chris@0
|
145 array('kohana-module', true),
|
Chris@0
|
146 array('lms-plugin', true),
|
Chris@0
|
147 array('lms-template', true),
|
Chris@0
|
148 array('lms-document-template', true),
|
Chris@0
|
149 array('lms-userpanel-module', true),
|
Chris@0
|
150 array('laravel-library', true),
|
Chris@0
|
151 array('lavalite-theme', true),
|
Chris@0
|
152 array('lavalite-package', true),
|
Chris@0
|
153 array('lithium-library', true),
|
Chris@0
|
154 array('magento-library', true),
|
Chris@0
|
155 array('majima-plugin', true),
|
Chris@0
|
156 array('mako-package', true),
|
Chris@0
|
157 array('modx-extra', true),
|
Chris@0
|
158 array('modxevo-snippet', true),
|
Chris@0
|
159 array('modxevo-plugin', true),
|
Chris@0
|
160 array('modxevo-module', true),
|
Chris@0
|
161 array('modxevo-template', true),
|
Chris@0
|
162 array('modxevo-lib', true),
|
Chris@0
|
163 array('mediawiki-extension', true),
|
Chris@0
|
164 array('mediawiki-skin', true),
|
Chris@0
|
165 array('microweber-module', true),
|
Chris@0
|
166 array('modulework-module', true),
|
Chris@0
|
167 array('moodle-mod', true),
|
Chris@0
|
168 array('october-module', true),
|
Chris@0
|
169 array('october-plugin', true),
|
Chris@0
|
170 array('piwik-plugin', true),
|
Chris@0
|
171 array('pxcms-module', true),
|
Chris@0
|
172 array('pxcms-theme', true),
|
Chris@0
|
173 array('phpbb-extension', true),
|
Chris@0
|
174 array('pimcore-plugin', true),
|
Chris@0
|
175 array('plentymarkets-plugin', true),
|
Chris@0
|
176 array('ppi-module', true),
|
Chris@0
|
177 array('prestashop-module', true),
|
Chris@0
|
178 array('prestashop-theme', true),
|
Chris@0
|
179 array('puppet-module', true),
|
Chris@0
|
180 array('porto-container', true),
|
Chris@0
|
181 array('radphp-bundle', true),
|
Chris@0
|
182 array('redaxo-addon', true),
|
Chris@0
|
183 array('redaxo-bestyle-plugin', true),
|
Chris@0
|
184 array('reindex-theme', true),
|
Chris@0
|
185 array('reindex-plugin', true),
|
Chris@0
|
186 array('roundcube-plugin', true),
|
Chris@0
|
187 array('shopware-backend-plugin', true),
|
Chris@0
|
188 array('shopware-core-plugin', true),
|
Chris@0
|
189 array('shopware-frontend-plugin', true),
|
Chris@0
|
190 array('shopware-theme', true),
|
Chris@0
|
191 array('shopware-plugin', true),
|
Chris@0
|
192 array('shopware-frontend-theme', true),
|
Chris@0
|
193 array('silverstripe-module', true),
|
Chris@0
|
194 array('silverstripe-theme', true),
|
Chris@0
|
195 array('smf-module', true),
|
Chris@0
|
196 array('smf-theme', true),
|
Chris@0
|
197 array('sydes-module', true),
|
Chris@0
|
198 array('sydes-theme', true),
|
Chris@0
|
199 array('symfony1-plugin', true),
|
Chris@0
|
200 array('thelia-module', true),
|
Chris@0
|
201 array('thelia-frontoffice-template', true),
|
Chris@0
|
202 array('thelia-backoffice-template', true),
|
Chris@0
|
203 array('thelia-email-template', true),
|
Chris@0
|
204 array('tusk-task', true),
|
Chris@0
|
205 array('tusk-asset', true),
|
Chris@0
|
206 array('typo3-flow-plugin', true),
|
Chris@0
|
207 array('typo3-cms-extension', true),
|
Chris@0
|
208 array('userfrosting-sprinkle', true),
|
Chris@0
|
209 array('vanilla-plugin', true),
|
Chris@0
|
210 array('vanilla-theme', true),
|
Chris@0
|
211 array('whmcs-gateway', true),
|
Chris@0
|
212 array('wolfcms-plugin', true),
|
Chris@0
|
213 array('wordpress-plugin', true),
|
Chris@0
|
214 array('wordpress-core', false),
|
Chris@0
|
215 array('yawik-module', true),
|
Chris@0
|
216 array('zend-library', true),
|
Chris@0
|
217 array('zikula-module', true),
|
Chris@0
|
218 array('zikula-theme', true),
|
Chris@0
|
219 array('kodicms-plugin', true),
|
Chris@0
|
220 array('kodicms-media', true),
|
Chris@0
|
221 array('phifty-bundle', true),
|
Chris@0
|
222 array('phifty-library', true),
|
Chris@0
|
223 array('phifty-framework', true),
|
Chris@0
|
224 array('osclass-plugin', true),
|
Chris@0
|
225 array('osclass-theme', true),
|
Chris@0
|
226 array('osclass-language', true),
|
Chris@0
|
227 );
|
Chris@0
|
228 }
|
Chris@0
|
229
|
Chris@0
|
230 /**
|
Chris@0
|
231 * testInstallPath
|
Chris@0
|
232 *
|
Chris@0
|
233 * @dataProvider dataForTestInstallPath
|
Chris@0
|
234 */
|
Chris@0
|
235 public function testInstallPath($type, $path, $name, $version = '1.0.0')
|
Chris@0
|
236 {
|
Chris@0
|
237 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
238 $package = new Package($name, $version, $version);
|
Chris@0
|
239
|
Chris@0
|
240 $package->setType($type);
|
Chris@0
|
241 $result = $installer->getInstallPath($package);
|
Chris@0
|
242 $this->assertEquals($path, $result);
|
Chris@0
|
243 }
|
Chris@0
|
244
|
Chris@0
|
245 /**
|
Chris@0
|
246 * dataFormTestInstallPath
|
Chris@0
|
247 */
|
Chris@0
|
248 public function dataForTestInstallPath()
|
Chris@0
|
249 {
|
Chris@0
|
250 return array(
|
Chris@0
|
251 array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
|
Chris@0
|
252 array('aimeos-extension', 'ext/ai-test/', 'author/ai-test'),
|
Chris@0
|
253 array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
|
Chris@0
|
254 array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
|
Chris@0
|
255 array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),
|
Chris@0
|
256 array('attogram-module', 'modules/my_module/', 'author/my_module'),
|
Chris@0
|
257 array('bitrix-module', 'bitrix/modules/my_module/', 'author/my_module'),
|
Chris@0
|
258 array('bitrix-component', 'bitrix/components/my_component/', 'author/my_component'),
|
Chris@0
|
259 array('bitrix-theme', 'bitrix/templates/my_theme/', 'author/my_theme'),
|
Chris@0
|
260 array('bitrix-d7-module', 'bitrix/modules/author.my_module/', 'author/my_module'),
|
Chris@0
|
261 array('bitrix-d7-component', 'bitrix/components/author/my_component/', 'author/my_component'),
|
Chris@0
|
262 array('bitrix-d7-template', 'bitrix/templates/author_my_template/', 'author/my_template'),
|
Chris@0
|
263 array('bonefish-package', 'Packages/bonefish/package/', 'bonefish/package'),
|
Chris@0
|
264 array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'),
|
Chris@0
|
265 array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'),
|
Chris@0
|
266 array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'),
|
Chris@0
|
267 array('cockpit-module', 'cockpit/modules/addons/My_module/', 'piotr-cz/cockpit-my_module'),
|
Chris@0
|
268 array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'),
|
Chris@0
|
269 array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'),
|
Chris@0
|
270 array('concrete5-block', 'application/blocks/concrete5_block/', 'remo/concrete5_block'),
|
Chris@0
|
271 array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'),
|
Chris@0
|
272 array('concrete5-theme', 'application/themes/concrete5_theme/', 'remo/concrete5_theme'),
|
Chris@0
|
273 array('concrete5-core', 'concrete/', 'concrete5/core'),
|
Chris@0
|
274 array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'),
|
Chris@0
|
275 array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'),
|
Chris@0
|
276 array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'),
|
Chris@0
|
277 array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'),
|
Chris@0
|
278 array('decibel-app', 'app/someapp/', 'author/someapp'),
|
Chris@0
|
279 array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'),
|
Chris@0
|
280 array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'),
|
Chris@0
|
281 array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'),
|
Chris@0
|
282 array('drupal-module', 'modules/my_module/', 'shama/my_module'),
|
Chris@0
|
283 array('drupal-theme', 'themes/my_module/', 'shama/my_module'),
|
Chris@0
|
284 array('drupal-profile', 'profiles/my_module/', 'shama/my_module'),
|
Chris@0
|
285 array('drupal-drush', 'drush/my_module/', 'shama/my_module'),
|
Chris@0
|
286 array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'),
|
Chris@0
|
287 array('eliasis-component', 'components/my_component/', 'shama/my_component'),
|
Chris@0
|
288 array('eliasis-module', 'modules/my_module/', 'shama/my_module'),
|
Chris@0
|
289 array('eliasis-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
290 array('eliasis-template', 'templates/my_template/', 'shama/my_template'),
|
Chris@0
|
291 array('ee3-addon', 'system/user/addons/ee_theme/', 'author/ee_theme'),
|
Chris@0
|
292 array('ee3-theme', 'themes/user/ee_package/', 'author/ee_package'),
|
Chris@0
|
293 array('ee2-addon', 'system/expressionengine/third_party/ee_theme/', 'author/ee_theme'),
|
Chris@0
|
294 array('ee2-theme', 'themes/third_party/ee_package/', 'author/ee_package'),
|
Chris@0
|
295 array('ezplatform-assets', 'web/assets/ezplatform/ezplatform_comp/', 'author/ezplatform_comp'),
|
Chris@0
|
296 array('ezplatform-meta-assets', 'web/assets/ezplatform/', 'author/ezplatform_comp'),
|
Chris@0
|
297 array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'),
|
Chris@0
|
298 array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'),
|
Chris@0
|
299 array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'),
|
Chris@0
|
300 array('fuelphp-component', 'components/demo/', 'fuelphp/demo'),
|
Chris@0
|
301 array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'),
|
Chris@0
|
302 array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'),
|
Chris@0
|
303 array('imagecms-template', 'templates/my_template/', 'shama/my_template'),
|
Chris@0
|
304 array('imagecms-module', 'application/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
305 array('imagecms-library', 'application/libraries/my_library/', 'shama/my_library'),
|
Chris@0
|
306 array('itop-extension', 'extensions/my_extension/', 'shama/my_extension'),
|
Chris@0
|
307 array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
308 array('kanboard-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
309 array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
310 array('kohana-module', 'modules/my_package/', 'shama/my_package'),
|
Chris@0
|
311 array('lms-plugin', 'plugins/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
312 array('lms-plugin', 'plugins/MyPackage/', 'shama/my_package'),
|
Chris@0
|
313 array('lms-template', 'templates/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
314 array('lms-template', 'templates/MyPackage/', 'shama/my_package'),
|
Chris@0
|
315 array('lms-document-template', 'documents/templates/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
316 array('lms-document-template', 'documents/templates/MyPackage/', 'shama/my_package'),
|
Chris@0
|
317 array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/MyPackage'),
|
Chris@0
|
318 array('lms-userpanel-module', 'userpanel/modules/MyPackage/', 'shama/my_package'),
|
Chris@0
|
319 array('laravel-library', 'libraries/my_package/', 'shama/my_package'),
|
Chris@0
|
320 array('lavalite-theme', 'public/themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
321 array('lavalite-package', 'packages/my_group/my_package/', 'my_group/my_package'),
|
Chris@0
|
322 array('lithium-library', 'libraries/li3_test/', 'user/li3_test'),
|
Chris@0
|
323 array('magento-library', 'lib/foo/', 'test/foo'),
|
Chris@0
|
324 array('majima-plugin', 'plugins/MyPlugin/', 'shama/my-plugin'),
|
Chris@0
|
325 array('modx-extra', 'core/packages/extra/', 'vendor/extra'),
|
Chris@0
|
326 array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'),
|
Chris@0
|
327 array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
328 array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
329 array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'),
|
Chris@0
|
330 array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'),
|
Chris@0
|
331 array('mako-package', 'app/packages/my_package/', 'shama/my_package'),
|
Chris@0
|
332 array('mediawiki-extension', 'extensions/APC/', 'author/APC'),
|
Chris@0
|
333 array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'),
|
Chris@0
|
334 array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'),
|
Chris@0
|
335 array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'),
|
Chris@0
|
336 array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'),
|
Chris@0
|
337 array('mediawiki-skin', 'skins/someskin/', 'author/someskin'),
|
Chris@0
|
338 array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'),
|
Chris@0
|
339 array('modulework-module', 'modules/my_package/', 'shama/my_package'),
|
Chris@0
|
340 array('moodle-mod', 'mod/my_package/', 'shama/my_package'),
|
Chris@0
|
341 array('october-module', 'modules/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
342 array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
343 array('october-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
344 array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'),
|
Chris@0
|
345 array('prestashop-module', 'modules/a-module/', 'vendor/a-module'),
|
Chris@0
|
346 array('prestashop-theme', 'themes/a-theme/', 'vendor/a-theme'),
|
Chris@0
|
347 array('pxcms-module', 'app/Modules/Foo/', 'vendor/module-foo'),
|
Chris@0
|
348 array('pxcms-module', 'app/Modules/Foo/', 'vendor/pxcms-foo'),
|
Chris@0
|
349 array('pxcms-theme', 'themes/Foo/', 'vendor/theme-foo'),
|
Chris@0
|
350 array('pxcms-theme', 'themes/Foo/', 'vendor/pxcms-foo'),
|
Chris@0
|
351 array('phpbb-extension', 'ext/test/foo/', 'test/foo'),
|
Chris@0
|
352 array('phpbb-style', 'styles/foo/', 'test/foo'),
|
Chris@0
|
353 array('phpbb-language', 'language/foo/', 'test/foo'),
|
Chris@0
|
354 array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'),
|
Chris@0
|
355 array('plentymarkets-plugin', 'HelloWorld/', 'plugin-hello-world'),
|
Chris@0
|
356 array('ppi-module', 'modules/foo/', 'test/foo'),
|
Chris@0
|
357 array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'),
|
Chris@0
|
358 array('porto-container', 'app/Containers/container-name/', 'test/container-name'),
|
Chris@0
|
359 array('radphp-bundle', 'src/Migration/', 'atkrad/migration'),
|
Chris@0
|
360 array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
361 array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
362 array('reindex-theme', 'themes/my_module/', 'author/my_module'),
|
Chris@0
|
363 array('reindex-plugin', 'plugins/my_module/', 'author/my_module'),
|
Chris@0
|
364 array('roundcube-plugin', 'plugins/base/', 'test/base'),
|
Chris@0
|
365 array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'),
|
Chris@0
|
366 array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'),
|
Chris@0
|
367 array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'),
|
Chris@0
|
368 array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'),
|
Chris@0
|
369 array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'),
|
Chris@0
|
370 array('shopware-frontend-theme', 'themes/Frontend/ShamaMyFrontendTheme/', 'shama/my-frontend-theme'),
|
Chris@0
|
371 array('shopware-plugin', 'custom/plugins/ShamaMyPlugin/', 'shama/my-plugin'),
|
Chris@0
|
372 array('silverstripe-module', 'my_module/', 'shama/my_module'),
|
Chris@0
|
373 array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'),
|
Chris@0
|
374 array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'),
|
Chris@0
|
375 array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'),
|
Chris@0
|
376 array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'),
|
Chris@0
|
377 array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
378 array('smf-module', 'Sources/my_module/', 'shama/my_module'),
|
Chris@0
|
379 array('smf-theme', 'Themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
380 array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'),
|
Chris@0
|
381 array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'),
|
Chris@0
|
382 array('thelia-module', 'local/modules/my_module/', 'shama/my_module'),
|
Chris@0
|
383 array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'),
|
Chris@0
|
384 array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'),
|
Chris@0
|
385 array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'),
|
Chris@0
|
386 array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'),
|
Chris@0
|
387 array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'),
|
Chris@0
|
388 array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'),
|
Chris@0
|
389 array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'),
|
Chris@0
|
390 array('userfrosting-sprinkle', 'app/sprinkles/my_sprinkle/', 'shama/my_sprinkle'),
|
Chris@0
|
391 array('vanilla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
392 array('vanilla-theme', 'themes/my_theme/', 'shama/my_theme'),
|
Chris@0
|
393 array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'),
|
Chris@0
|
394 array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
395 array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
396 array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
397 array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'),
|
Chris@0
|
398 array('zikula-module', 'modules/my-test_module/', 'my/test_module'),
|
Chris@0
|
399 array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'),
|
Chris@0
|
400 array('kodicms-media', 'cms/media/vendor/my_media/', 'shama/my_media'),
|
Chris@0
|
401 array('kodicms-plugin', 'cms/plugins/my_plugin/', 'shama/my_plugin'),
|
Chris@0
|
402 array('phifty-bundle', 'bundles/core/', 'shama/core'),
|
Chris@0
|
403 array('phifty-library', 'libraries/my-lib/', 'shama/my-lib'),
|
Chris@0
|
404 array('phifty-framework', 'frameworks/my-framework/', 'shama/my-framework'),
|
Chris@0
|
405 array('yawik-module', 'module/MyModule/', 'shama/my_module'),
|
Chris@0
|
406 array('osclass-plugin', 'oc-content/plugins/sample_plugin/', 'test/sample_plugin'),
|
Chris@0
|
407 array('osclass-theme', 'oc-content/themes/sample_theme/', 'test/sample_theme'),
|
Chris@0
|
408 array('osclass-language', 'oc-content/languages/sample_lang/', 'test/sample_lang'),
|
Chris@0
|
409 );
|
Chris@0
|
410 }
|
Chris@0
|
411
|
Chris@0
|
412 /**
|
Chris@0
|
413 * testGetCakePHPInstallPathException
|
Chris@0
|
414 *
|
Chris@0
|
415 * @return void
|
Chris@0
|
416 *
|
Chris@0
|
417 * @expectedException \InvalidArgumentException
|
Chris@0
|
418 */
|
Chris@0
|
419 public function testGetCakePHPInstallPathException()
|
Chris@0
|
420 {
|
Chris@0
|
421 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
422 $package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
Chris@0
|
423
|
Chris@0
|
424 $package->setType('cakephp-whoops');
|
Chris@0
|
425 $result = $installer->getInstallPath($package);
|
Chris@0
|
426 }
|
Chris@0
|
427
|
Chris@0
|
428 /**
|
Chris@0
|
429 * testCustomInstallPath
|
Chris@0
|
430 */
|
Chris@0
|
431 public function testCustomInstallPath()
|
Chris@0
|
432 {
|
Chris@0
|
433 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
434 $package = new Package('shama/ftp', '1.0.0', '1.0.0');
|
Chris@0
|
435 $package->setType('cakephp-plugin');
|
Chris@0
|
436 $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
Chris@0
|
437 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
438 $consumerPackage->setExtra(array(
|
Chris@0
|
439 'installer-paths' => array(
|
Chris@0
|
440 'my/custom/path/{$name}/' => array(
|
Chris@0
|
441 'shama/ftp',
|
Chris@0
|
442 'foo/bar',
|
Chris@0
|
443 ),
|
Chris@0
|
444 ),
|
Chris@0
|
445 ));
|
Chris@0
|
446 $result = $installer->getInstallPath($package);
|
Chris@0
|
447 $this->assertEquals('my/custom/path/Ftp/', $result);
|
Chris@0
|
448 }
|
Chris@0
|
449
|
Chris@0
|
450 /**
|
Chris@0
|
451 * testCustomInstallerName
|
Chris@0
|
452 */
|
Chris@0
|
453 public function testCustomInstallerName()
|
Chris@0
|
454 {
|
Chris@0
|
455 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
456 $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0');
|
Chris@0
|
457 $package->setType('cakephp-plugin');
|
Chris@0
|
458 $package->setExtra(array(
|
Chris@0
|
459 'installer-name' => 'FTP',
|
Chris@0
|
460 ));
|
Chris@0
|
461 $result = $installer->getInstallPath($package);
|
Chris@0
|
462 $this->assertEquals('Plugin/FTP/', $result);
|
Chris@0
|
463 }
|
Chris@0
|
464
|
Chris@0
|
465 /**
|
Chris@0
|
466 * testCustomTypePath
|
Chris@0
|
467 */
|
Chris@0
|
468 public function testCustomTypePath()
|
Chris@0
|
469 {
|
Chris@0
|
470 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
471 $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0');
|
Chris@0
|
472 $package->setType('wordpress-plugin');
|
Chris@0
|
473 $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
|
Chris@0
|
474 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
475 $consumerPackage->setExtra(array(
|
Chris@0
|
476 'installer-paths' => array(
|
Chris@0
|
477 'my/custom/path/{$name}/' => array(
|
Chris@0
|
478 'type:wordpress-plugin'
|
Chris@0
|
479 ),
|
Chris@0
|
480 ),
|
Chris@0
|
481 ));
|
Chris@0
|
482 $result = $installer->getInstallPath($package);
|
Chris@0
|
483 $this->assertEquals('my/custom/path/my_plugin/', $result);
|
Chris@0
|
484 }
|
Chris@0
|
485
|
Chris@0
|
486 /**
|
Chris@0
|
487 * testVendorPath
|
Chris@0
|
488 */
|
Chris@0
|
489 public function testVendorPath()
|
Chris@0
|
490 {
|
Chris@0
|
491 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
492 $package = new Package('penyaskito/my_module', '1.0.0', '1.0.0');
|
Chris@0
|
493 $package->setType('drupal-module');
|
Chris@0
|
494 $consumerPackage = new RootPackage('drupal/drupal', '1.0.0', '1.0.0');
|
Chris@0
|
495 $this->composer->setPackage($consumerPackage);
|
Chris@0
|
496 $consumerPackage->setExtra(array(
|
Chris@0
|
497 'installer-paths' => array(
|
Chris@0
|
498 'modules/custom/{$name}/' => array(
|
Chris@0
|
499 'vendor:penyaskito'
|
Chris@0
|
500 ),
|
Chris@0
|
501 ),
|
Chris@0
|
502 ));
|
Chris@0
|
503 $result = $installer->getInstallPath($package);
|
Chris@0
|
504 $this->assertEquals('modules/custom/my_module/', $result);
|
Chris@0
|
505 }
|
Chris@0
|
506
|
Chris@0
|
507 /**
|
Chris@0
|
508 * testNoVendorName
|
Chris@0
|
509 */
|
Chris@0
|
510 public function testNoVendorName()
|
Chris@0
|
511 {
|
Chris@0
|
512 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
513 $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0');
|
Chris@0
|
514
|
Chris@0
|
515 $package->setType('symfony1-plugin');
|
Chris@0
|
516 $result = $installer->getInstallPath($package);
|
Chris@0
|
517 $this->assertEquals('plugins/sfPhpunitPlugin/', $result);
|
Chris@0
|
518 }
|
Chris@0
|
519
|
Chris@0
|
520 /**
|
Chris@0
|
521 * testTypo3Inflection
|
Chris@0
|
522 */
|
Chris@0
|
523 public function testTypo3Inflection()
|
Chris@0
|
524 {
|
Chris@0
|
525 $installer = new Installer($this->io, $this->composer);
|
Chris@0
|
526 $package = new Package('typo3/fluid', '1.0.0', '1.0.0');
|
Chris@0
|
527
|
Chris@0
|
528 $package->setAutoload(array(
|
Chris@0
|
529 'psr-0' => array(
|
Chris@0
|
530 'TYPO3\\Fluid' => 'Classes',
|
Chris@0
|
531 ),
|
Chris@0
|
532 ));
|
Chris@0
|
533
|
Chris@0
|
534 $package->setType('typo3-flow-package');
|
Chris@0
|
535 $result = $installer->getInstallPath($package);
|
Chris@0
|
536 $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result);
|
Chris@0
|
537 }
|
Chris@0
|
538
|
Chris@0
|
539 public function testUninstallAndDeletePackageFromLocalRepo()
|
Chris@0
|
540 {
|
Chris@0
|
541 $package = new Package('foo', '1.0.0', '1.0.0');
|
Chris@0
|
542
|
Chris@0
|
543 $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer));
|
Chris@0
|
544 $installer->expects($this->atLeastOnce())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo'));
|
Chris@0
|
545
|
Chris@0
|
546 $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface');
|
Chris@0
|
547 $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true));
|
Chris@0
|
548 $repo->expects($this->once())->method('removePackage')->with($package);
|
Chris@0
|
549
|
Chris@0
|
550 $installer->uninstall($repo, $package);
|
Chris@0
|
551 }
|
Chris@0
|
552 }
|