Mercurial > hg > cmmr2012-drupal-site
annotate vendor/composer/installers/tests/Composer/Installers/Test/MayaInstallerTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 namespace Composer\Installers\Test; |
Chris@0 | 3 |
Chris@0 | 4 use Composer\Installers\MayaInstaller; |
Chris@0 | 5 use Composer\Package\Package; |
Chris@0 | 6 use Composer\Composer; |
Chris@0 | 7 use PHPUnit\Framework\TestCase as BaseTestCase; |
Chris@0 | 8 |
Chris@0 | 9 class MayaInstallerTest extends BaseTestCase |
Chris@0 | 10 { |
Chris@0 | 11 /** |
Chris@0 | 12 * @var MayaInstaller |
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 MayaInstaller( |
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 array('name' => $expected, 'type' => $type), |
Chris@0 | 31 $this->installer->inflectPackageVars(array('name' => $name, '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 // Should keep module name StudlyCase |
Chris@0 | 39 array( |
Chris@0 | 40 'maya-module', |
Chris@0 | 41 'user-profile', |
Chris@0 | 42 'UserProfile' |
Chris@0 | 43 ), |
Chris@0 | 44 array( |
Chris@0 | 45 'maya-module', |
Chris@0 | 46 'maya-module', |
Chris@0 | 47 'Maya' |
Chris@0 | 48 ), |
Chris@0 | 49 array( |
Chris@0 | 50 'maya-module', |
Chris@0 | 51 'blog', |
Chris@0 | 52 'Blog' |
Chris@0 | 53 ), |
Chris@0 | 54 // tests that exactly one '-module' is cut off |
Chris@0 | 55 array( |
Chris@0 | 56 'maya-module', |
Chris@0 | 57 'some-module-module', |
Chris@0 | 58 'SomeModule', |
Chris@0 | 59 ), |
Chris@0 | 60 ); |
Chris@0 | 61 } |
Chris@0 | 62 } |