Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

75 lines
3.1KB

  1. <?php
  2. /*
  3. * This file is part of the Fxp Composer Asset Plugin package.
  4. *
  5. * (c) François Pluchino <francois.pluchino@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Fxp\Composer\AssetPlugin\Tests\Repository;
  11. use Fxp\Composer\AssetPlugin\Repository\Util;
  12. /**
  13. * Repository Util Tests.
  14. *
  15. * @author François Pluchino <francois.pluchino@gmail.com>
  16. */
  17. class UtilTest extends \PHPUnit_Framework_TestCase
  18. {
  19. public function getPackageNames()
  20. {
  21. return array(
  22. array('vendor/package', 'vendor/package'),
  23. array('vendor/package-name', 'vendor/package-name'),
  24. array('vendor/package_name', 'vendor/package_name'),
  25. array('vendor/package-1', 'vendor/package-1'),
  26. array('vendor/package_1', 'vendor/package_1'),
  27. array('vendor/package-name-1', 'vendor/package-name-1'),
  28. array('vendor/package_name_1', 'vendor/package_name_1'),
  29. array('vendor/package-1.0', 'vendor/package'),
  30. array('vendor/package-1.x', 'vendor/package'),
  31. array('vendor/package-1.X', 'vendor/package'),
  32. array('vendor/package-1.0.0', 'vendor/package'),
  33. array('vendor/package-1.0.x', 'vendor/package'),
  34. array('vendor/package-1.0.X', 'vendor/package'),
  35. array('vendor-name/package', 'vendor-name/package'),
  36. array('vendor-name/package-name', 'vendor-name/package-name'),
  37. array('vendor-name/package-1', 'vendor-name/package-1'),
  38. array('vendor-name/package-name-1', 'vendor-name/package-name-1'),
  39. array('vendor-name/package-1.0', 'vendor-name/package'),
  40. array('vendor-name/package-1.x', 'vendor-name/package'),
  41. array('vendor-name/package-1.X', 'vendor-name/package'),
  42. array('vendor-name/package-1.0.0', 'vendor-name/package'),
  43. array('vendor-name/package-1.0.x', 'vendor-name/package'),
  44. array('vendor-name/package-1.0.X', 'vendor-name/package'),
  45. array('vendor_name/package', 'vendor_name/package'),
  46. array('vendor_name/package-name', 'vendor_name/package-name'),
  47. array('vendor_name/package-1', 'vendor_name/package-1'),
  48. array('vendor_name/package-name-1', 'vendor_name/package-name-1'),
  49. array('vendor_name/package-1.0', 'vendor_name/package'),
  50. array('vendor_name/package-1.x', 'vendor_name/package'),
  51. array('vendor_name/package-1.X', 'vendor_name/package'),
  52. array('vendor_name/package-1.0.0', 'vendor_name/package'),
  53. array('vendor_name/package-1.0.x', 'vendor_name/package'),
  54. array('vendor_name/package-1.0.X', 'vendor_name/package'),
  55. );
  56. }
  57. /**
  58. * @dataProvider getPackageNames
  59. *
  60. * @param string $name
  61. * @param string $validName
  62. */
  63. public function testConvertAliasName($name, $validName)
  64. {
  65. $this->assertSame($validName, Util::convertAliasName($name));
  66. }
  67. }