ComposerInstallersTestCraftInstallerTest

Tests for the CraftInstaller Class.

Defined (1)

The class is defined in the following location(s).

/vendor/composer/installers/tests/Composer/Installers/Test/CraftInstallerTest.php  
  1. class CraftInstallerTest extends TestCase 
  2. /** @var CraftInstaller */ 
  3. private $installer; 
  4.  
  5. /** 
  6. * Sets up the fixture, for example, instantiate the class-under-test. 
  7. * This method is called before a test is executed. 
  8. */ 
  9. final public function setup() 
  10. $this->installer = new CraftInstaller(); 
  11.  
  12. /** 
  13. * @param string $packageName 
  14. * @param string $expectedName 
  15. * @covers ::inflectPackageVars 
  16. * @dataProvider provideExpectedInflectionResults 
  17. */ 
  18. final public function testInflectPackageVars($packageName, $expectedName) 
  19. $installer = $this->installer; 
  20.  
  21. $vars = array('name' => $packageName); 
  22. $expected = array('name' => $expectedName); 
  23.  
  24. $actual = $installer->inflectPackageVars($vars); 
  25.  
  26. $this->assertEquals($actual, $expected); 
  27.  
  28. /** 
  29. * Provides various names for packages and the expected result after inflection 
  30. * @return array 
  31. */ 
  32. final public function provideExpectedInflectionResults() 
  33. return array( 
  34. // lowercase 
  35. array('foo', 'foo'),  
  36. array('craftfoo', 'craftfoo'),  
  37. array('fooplugin', 'fooplugin'),  
  38. array('craftfooplugin', 'craftfooplugin'),  
  39. // lowercase - dash 
  40. array('craft-foo', 'foo'),  
  41. array('foo-plugin', 'foo'),  
  42. array('craft-foo-plugin', 'foo'),  
  43. // lowercase - underscore 
  44. array('craft_foo', 'craft_foo'),  
  45. array('foo_plugin', 'foo_plugin'),  
  46. array('craft_foo_plugin', 'craft_foo_plugin'),  
  47. // CamelCase 
  48. array('Foo', 'Foo'),  
  49. array('CraftFoo', 'CraftFoo'),  
  50. array('FooPlugin', 'FooPlugin'),  
  51. array('CraftFooPlugin', 'CraftFooPlugin'),  
  52. // CamelCase - Dash 
  53. array('Craft-Foo', 'Foo'),  
  54. array('Foo-Plugin', 'Foo'),  
  55. array('Craft-Foo-Plugin', 'Foo'),  
  56. // CamelCase - underscore 
  57. array('Craft_Foo', 'Craft_Foo'),  
  58. array('Foo_Plugin', 'Foo_Plugin'),  
  59. array('Craft_Foo_Plugin', 'Craft_Foo_Plugin'),  
  60. );