Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

69 lines
1.5KB

  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\Util;
  11. use Fxp\Composer\AssetPlugin\Assets;
  12. use Fxp\Composer\AssetPlugin\Util\Validator;
  13. /**
  14. * Tests for the validator.
  15. *
  16. * @author François Pluchino <francois.pluchino@gmail.com>
  17. */
  18. class ValidatorTest extends \PHPUnit_Framework_TestCase
  19. {
  20. public function testValidBranch()
  21. {
  22. $this->assertNotFalse(Validator::validateBranch('master'));
  23. }
  24. public function testInvalidBranch()
  25. {
  26. $this->assertFalse(Validator::validateBranch('1.x'));
  27. }
  28. /**
  29. * Data provider.
  30. *
  31. * @return array
  32. */
  33. public function getAssetTypes()
  34. {
  35. return array(
  36. array('npm'),
  37. array('bower'),
  38. );
  39. }
  40. /**
  41. * @param $type
  42. *
  43. * @dataProvider getAssetTypes
  44. */
  45. public function testValidTag($type)
  46. {
  47. $assetType = Assets::createType($type);
  48. $this->assertNotFalse(Validator::validateTag('1.0.0', $assetType));
  49. }
  50. /**
  51. * @param $type
  52. *
  53. * @dataProvider getAssetTypes
  54. */
  55. public function testInvalidTag($type)
  56. {
  57. $assetType = Assets::createType($type);
  58. $this->assertFalse(Validator::validateTag('version', $assetType));
  59. }
  60. }