]> _ Git - couzy.git/blob
fd427cdc3112120867c9100fb5b0a3be3b83c6ae
[couzy.git] /
1 <?php
2 namespace Composer\Installers\Test;
3
4 use Composer\Installers\OctoberInstaller;
5 use Composer\Package\Package;
6 use Composer\Composer;
7
8 class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
9 {
10     /**
11      * @var OctoberInstaller
12      */
13     private $installer;
14
15     public function setUp()
16     {
17         $this->installer = new OctoberInstaller(
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                 'october-plugin',
39                 'subpagelist',
40                 'subpagelist',
41             ),
42             array(
43                 'october-plugin',
44                 'subpagelist-plugin',
45                 'subpagelist',
46             ),
47             array(
48                 'october-plugin',
49                 'semanticoctober',
50                 'semanticoctober',
51             ),
52             // tests that exactly one '-theme' is cut off
53             array(
54                 'october-theme',
55                 'some-theme-theme',
56                 'some-theme',
57             ),
58             // tests that names without '-theme' suffix stay valid
59             array(
60                 'october-theme',
61                 'someothertheme',
62                 'someothertheme',
63             ),
64         );
65     }
66 }