OctoberInstallerTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace Composer\Installers\Test;
  3. use Composer\Installers\OctoberInstaller;
  4. use Composer\Package\Package;
  5. use Composer\Composer;
  6. class OctoberInstallerTest extends \PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * @var OctoberInstaller
  10. */
  11. private $installer;
  12. public function setUp()
  13. {
  14. $this->installer = new OctoberInstaller(
  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. 'october-plugin',
  34. 'subpagelist',
  35. 'subpagelist',
  36. ),
  37. array(
  38. 'october-plugin',
  39. 'subpagelist-plugin',
  40. 'subpagelist',
  41. ),
  42. array(
  43. 'october-plugin',
  44. 'semanticoctober',
  45. 'semanticoctober',
  46. ),
  47. // tests that exactly one '-theme' is cut off
  48. array(
  49. 'october-theme',
  50. 'some-theme-theme',
  51. 'some-theme',
  52. ),
  53. // tests that names without '-theme' suffix stay valid
  54. array(
  55. 'october-theme',
  56. 'someothertheme',
  57. 'someothertheme',
  58. ),
  59. );
  60. }
  61. }