DokuWikiInstallerTest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace Composer\Installers\Test;
  3. use Composer\Installers\DokuWikiInstaller;
  4. use Composer\Package\Package;
  5. use Composer\Composer;
  6. class DokuWikiInstallerTest extends \PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * @var DokuWikiInstaller
  10. */
  11. private $installer;
  12. public function setUp()
  13. {
  14. $this->installer = new DokuWikiInstaller(
  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. 'dokuwiki-plugin',
  34. 'dokuwiki-test-plugin',
  35. 'test',
  36. ),
  37. array(
  38. 'dokuwiki-plugin',
  39. 'test-plugin',
  40. 'test',
  41. ),
  42. array(
  43. 'dokuwiki-plugin',
  44. 'dokuwiki_test',
  45. 'test',
  46. ),
  47. array(
  48. 'dokuwiki-plugin',
  49. 'test',
  50. 'test',
  51. ),
  52. array(
  53. 'dokuwiki-plugin',
  54. 'test-template',
  55. 'test-template',
  56. ),
  57. array(
  58. 'dokuwiki-template',
  59. 'dokuwiki-test-template',
  60. 'test',
  61. ),
  62. array(
  63. 'dokuwiki-template',
  64. 'test-template',
  65. 'test',
  66. ),
  67. array(
  68. 'dokuwiki-template',
  69. 'dokuwiki_test',
  70. 'test',
  71. ),
  72. array(
  73. 'dokuwiki-template',
  74. 'test',
  75. 'test',
  76. ),
  77. array(
  78. 'dokuwiki-template',
  79. 'test-plugin',
  80. 'test-plugin',
  81. ),
  82. );
  83. }
  84. }