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