AsgardInstallerTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Composer\Installers\Test;
  3. use Composer\Installers\AsgardInstaller;
  4. use Composer\Package\Package;
  5. use Composer\Composer;
  6. class AsgardInstallerTest extends \PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * @var OctoberInstaller
  10. */
  11. private $installer;
  12. public function setUp()
  13. {
  14. $this->installer = new AsgardInstaller(
  15. new Package('NyanCat', '4.2', '4.2'),
  16. new Composer()
  17. );
  18. }
  19. /**
  20. * @dataProvider packageNameInflectionProvider
  21. */
  22. public function testInflectPackageVars($type, $name, $expected)
  23. {
  24. $this->assertEquals(
  25. $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)),
  26. array('name' => $expected, 'type' => $type)
  27. );
  28. }
  29. public function packageNameInflectionProvider()
  30. {
  31. return array(
  32. array(
  33. 'asgard-module',
  34. 'asgard-module',
  35. 'Asgard'
  36. ),
  37. array(
  38. 'asgard-module',
  39. 'blog',
  40. 'Blog'
  41. ),
  42. // tests that exactly one '-theme' is cut off
  43. array(
  44. 'asgard-theme',
  45. 'some-theme-theme',
  46. 'Some-theme',
  47. ),
  48. // tests that names without '-theme' suffix stay valid
  49. array(
  50. 'asgard-theme',
  51. 'someothertheme',
  52. 'Someothertheme',
  53. ),
  54. );
  55. }
  56. }