VersionParserTest.php 1.1 KB

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