You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 satır
2.0KB

  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;
  11. use Fxp\Composer\AssetPlugin\Assets;
  12. /**
  13. * Tests of assets factory.
  14. *
  15. * @author François Pluchino <francois.pluchino@gmail.com>
  16. */
  17. class AssetsTest extends \PHPUnit_Framework_TestCase
  18. {
  19. public function testGetTypes()
  20. {
  21. $this->assertEquals(array(
  22. 'npm',
  23. 'bower',
  24. ), Assets::getTypes());
  25. }
  26. public function testGetRegistries()
  27. {
  28. $this->assertEquals(array(
  29. 'npm',
  30. 'bower',
  31. ), array_keys(Assets::getRegistries()));
  32. }
  33. public function testGetVcsRepositoryDrivers()
  34. {
  35. $this->assertEquals(array(
  36. 'vcs',
  37. 'github',
  38. 'git-bitbucket',
  39. 'git',
  40. 'hg-bitbucket',
  41. 'hg',
  42. 'perforce',
  43. 'svn',
  44. ), array_keys(Assets::getVcsRepositoryDrivers()));
  45. }
  46. public function testGetVcsDrivers()
  47. {
  48. $this->assertEquals(array(
  49. 'github',
  50. 'git-bitbucket',
  51. 'git',
  52. 'hg-bitbucket',
  53. 'hg',
  54. 'perforce',
  55. 'svn',
  56. ), array_keys(Assets::getVcsDrivers()));
  57. }
  58. public function testCreationOfInvalidType()
  59. {
  60. $this->setExpectedException('InvalidArgumentException');
  61. Assets::createType(null);
  62. }
  63. public function testCreationOfNpmAsset()
  64. {
  65. $type = Assets::createType('npm');
  66. $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type);
  67. }
  68. public function testCreationOfBowerAsset()
  69. {
  70. $type = Assets::createType('bower');
  71. $this->assertInstanceOf('Fxp\Composer\AssetPlugin\Type\AssetTypeInterface', $type);
  72. }
  73. }