]> _ Git - couzy.git/blob
71480eca53f79fdc780a3184abc0874a9267ad93
[couzy.git] /
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 OctoberInstaller
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             $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
30             array('name' => $expected, 'type' => $type)
31         );
32     }
33
34     public function packageNameInflectionProvider()
35     {
36         return array(
37             array(
38                 'asgard-module',
39                 'asgard-module',
40                 'Asgard'
41             ),
42             array(
43                 'asgard-module',
44                 'blog',
45                 'Blog'
46             ),
47             // tests that exactly one '-theme' is cut off
48             array(
49                 'asgard-theme',
50                 'some-theme-theme',
51                 'Some-theme',
52             ),
53             // tests that names without '-theme' suffix stay valid
54             array(
55                 'asgard-theme',
56                 'someothertheme',
57                 'Someothertheme',
58             ),
59         );
60     }
61 }