6e615c772fa2672826c3605c586b12880ff94eae
[yaffs-website] / vendor / composer / installers / tests / Composer / Installers / Test / OctoberInstallerTest.php
1 <?php
2 namespace Composer\Installers\Test;
3
4 use Composer\Installers\OctoberInstaller;
5 use Composer\Package\Package;
6 use Composer\Composer;
7 use PHPUnit\Framework\TestCase as BaseTestCase;
8
9 class OctoberInstallerTest extends BaseTestCase
10 {
11     /**
12      * @var OctoberInstaller
13      */
14     private $installer;
15
16     public function setUp()
17     {
18         $this->installer = new OctoberInstaller(
19             new Package('NyanCat', '4.2', '4.2'),
20             new Composer()
21         );
22     }
23
24     /**
25      * @dataProvider packageNameInflectionProvider
26      */
27     public function testInflectPackageVars($type, $name, $expected)
28     {
29         $this->assertEquals(
30             $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
31             array('name' => $expected, 'type' => $type)
32         );
33     }
34
35     public function packageNameInflectionProvider()
36     {
37         return array(
38             array(
39                 'october-plugin',
40                 'subpagelist',
41                 'subpagelist',
42             ),
43             array(
44                 'october-plugin',
45                 'subpagelist-plugin',
46                 'subpagelist',
47             ),
48             array(
49                 'october-plugin',
50                 'semanticoctober',
51                 'semanticoctober',
52             ),
53             // tests that exactly one '-theme' is cut off
54             array(
55                 'october-theme',
56                 'some-theme-theme',
57                 'some-theme',
58             ),
59             // tests that names without '-theme' suffix stay valid
60             array(
61                 'october-theme',
62                 'someothertheme',
63                 'someothertheme',
64             ),
65         );
66     }
67 }