comparison vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 7a779792577d
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2 namespace Composer\Installers\Test;
3
4 use Composer\Installers\AsgardInstaller;
5 use Composer\Package\Package;
6 use Composer\Composer;
7
8 class AsgardInstallerTest extends \PHPUnit_Framework_TestCase
9 {
10 /**
11 * @var AsgardInstaller
12 */
13 private $installer;
14
15 public function setUp()
16 {
17 $this->installer = new AsgardInstaller(
18 new Package('NyanCat', '4.2', '4.2'),
19 new Composer()
20 );
21 }
22
23 /**
24 * @dataProvider packageNameInflectionProvider
25 */
26 public function testInflectPackageVars($type, $name, $expected)
27 {
28 $this->assertEquals(
29 array('name' => $expected, 'type' => $type),
30 $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type))
31 );
32 }
33
34 public function packageNameInflectionProvider()
35 {
36 return array(
37 // Should keep module name StudlyCase
38 array(
39 'asgard-module',
40 'user-profile',
41 'UserProfile'
42 ),
43 array(
44 'asgard-module',
45 'asgard-module',
46 'Asgard'
47 ),
48 array(
49 'asgard-module',
50 'blog',
51 'Blog'
52 ),
53 // tests that exactly one '-module' is cut off
54 array(
55 'asgard-module',
56 'some-module-module',
57 'SomeModule',
58 ),
59 // tests that exactly one '-theme' is cut off
60 array(
61 'asgard-theme',
62 'some-theme-theme',
63 'SomeTheme',
64 ),
65 // tests that names without '-theme' suffix stay valid
66 array(
67 'asgard-theme',
68 'someothertheme',
69 'Someothertheme',
70 ),
71 // Should keep theme name StudlyCase
72 array(
73 'asgard-theme',
74 'adminlte-advanced',
75 'AdminlteAdvanced'
76 ),
77 );
78 }
79 }