VersionParserTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\Package\Version;
  12. use Composer\Package\Version\VersionParser;
  13. class VersionParserTest extends \PHPUnit_Framework_TestCase
  14. {
  15. /**
  16. * @dataProvider getParseNameVersionPairsData
  17. */
  18. public function testParseNameVersionPairs($pairs, $result)
  19. {
  20. $versionParser = new VersionParser();
  21. $this->assertSame($result, $versionParser->parseNameVersionPairs($pairs));
  22. }
  23. public function getParseNameVersionPairsData()
  24. {
  25. return array(
  26. array(array('php:^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
  27. array(array('php', '^7.0'), array(array('name' => 'php', 'version' => '^7.0'))),
  28. array(array('php', 'ext-apcu'), array(array('name' => 'php'), array('name' => 'ext-apcu'))),
  29. );
  30. }
  31. }