TestCase.php 864 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test;
  12. use Composer\Package\Version\VersionParser;
  13. use Composer\Package\MemoryPackage;
  14. abstract class TestCase extends \PHPUnit_Framework_TestCase
  15. {
  16. private static $versionParser;
  17. public static function setUpBeforeClass()
  18. {
  19. if (!self::$versionParser) {
  20. self::$versionParser = new VersionParser();
  21. }
  22. }
  23. protected function getPackage($name, $version)
  24. {
  25. $normVersion = self::$versionParser->normalize($version);
  26. return new MemoryPackage($name, $normVersion, $version);
  27. }
  28. }