Yaffs site version 1.1
[yaffs-website] / vendor / composer / installers / tests / Composer / Installers / Test / CraftInstallerTest.php
1 <?php
2
3 namespace Composer\Installers\Test;
4
5 use Composer\Installers\CraftInstaller;
6
7 /**
8  * Tests for the CraftInstaller Class
9  *
10  * @coversDefaultClass Composer\Installers\CraftInstaller
11  */
12 class CraftInstallerTest extends TestCase
13 {
14     /** @var CraftInstaller */
15     private $installer;
16
17     /**
18      * Sets up the fixture, for example, instantiate the class-under-test.
19      *
20      * This method is called before a test is executed.
21      */
22     final public function setup()
23     {
24         $this->installer = new CraftInstaller();
25     }
26
27     /**
28      * @param string $packageName
29      * @param string $expectedName
30      *
31      * @covers ::inflectPackageVars
32      *
33      * @dataProvider provideExpectedInflectionResults
34      */
35     final public function testInflectPackageVars($packageName, $expectedName)
36     {
37         $installer = $this->installer;
38
39         $vars = array('name' => $packageName);
40         $expected = array('name' => $expectedName);
41
42         $actual = $installer->inflectPackageVars($vars);
43
44         $this->assertEquals($actual, $expected);
45     }
46
47     /**
48      * Provides various names for packages and the expected result after inflection
49      *
50      * @return array
51      */
52     final public function provideExpectedInflectionResults()
53     {
54         return array(
55             // lowercase
56             array('foo', 'foo'),
57             array('craftfoo', 'craftfoo'),
58             array('fooplugin', 'fooplugin'),
59             array('craftfooplugin', 'craftfooplugin'),
60             // lowercase - dash
61             array('craft-foo', 'foo'),
62             array('foo-plugin', 'foo'),
63             array('craft-foo-plugin', 'foo'),
64             // lowercase - underscore
65             array('craft_foo', 'craft_foo'),
66             array('foo_plugin', 'foo_plugin'),
67             array('craft_foo_plugin', 'craft_foo_plugin'),
68             // CamelCase
69             array('Foo', 'Foo'),
70             array('CraftFoo', 'CraftFoo'),
71             array('FooPlugin', 'FooPlugin'),
72             array('CraftFooPlugin', 'CraftFooPlugin'),
73             // CamelCase - Dash
74             array('Craft-Foo', 'Foo'),
75             array('Foo-Plugin', 'Foo'),
76             array('Craft-Foo-Plugin', 'Foo'),
77             // CamelCase - underscore
78             array('Craft_Foo', 'Craft_Foo'),
79             array('Foo_Plugin', 'Foo_Plugin'),
80             array('Craft_Foo_Plugin', 'Craft_Foo_Plugin'),
81         );
82     }
83 }