annotate vendor/composer/installers/tests/Composer/Installers/Test/VgmcpInstallerTest.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\VgmcpInstaller;
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 VgmcpInstallerTest extends BaseTestCase
Chris@0 10 {
Chris@0 11 /**
Chris@0 12 * @var VgmcpInstaller
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 VgmcpInstaller(
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 bundle name StudlyCase
Chris@0 39 array(
Chris@0 40 'vgmcp-bundle',
Chris@0 41 'user-profile',
Chris@0 42 'UserProfile'
Chris@0 43 ),
Chris@0 44 array(
Chris@0 45 'vgmcp-bundle',
Chris@0 46 'vgmcp-bundle',
Chris@0 47 'Vgmcp'
Chris@0 48 ),
Chris@0 49 array(
Chris@0 50 'vgmcp-bundle',
Chris@0 51 'blog',
Chris@0 52 'Blog'
Chris@0 53 ),
Chris@0 54 // tests that exactly one '-bundle' is cut off
Chris@0 55 array(
Chris@0 56 'vgmcp-bundle',
Chris@0 57 'some-bundle-bundle',
Chris@0 58 'SomeBundle',
Chris@0 59 ),
Chris@0 60 // tests that exactly one '-theme' is cut off
Chris@0 61 array(
Chris@0 62 'vgmcp-theme',
Chris@0 63 'some-theme-theme',
Chris@0 64 'SomeTheme',
Chris@0 65 ),
Chris@0 66 // tests that names without '-theme' suffix stay valid
Chris@0 67 array(
Chris@0 68 'vgmcp-theme',
Chris@0 69 'someothertheme',
Chris@0 70 'Someothertheme',
Chris@0 71 ),
Chris@0 72 // Should keep theme name StudlyCase
Chris@0 73 array(
Chris@0 74 'vgmcp-theme',
Chris@0 75 'adminlte-advanced',
Chris@0 76 'AdminlteAdvanced'
Chris@0 77 ),
Chris@0 78 );
Chris@0 79 }
Chris@0 80 }