CompilingMatcherTest.php 847 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of composer/semver.
  4. *
  5. * (c) Composer <https://github.com/composer>
  6. *
  7. * For the full copyright and license information, please view
  8. * the LICENSE file that was distributed with this source code.
  9. */
  10. namespace Composer\Semver;
  11. use Composer\Semver\Constraint\Constraint;
  12. use Composer\Semver\Constraint\MultiConstraint;
  13. use PHPUnit\Framework\TestCase;
  14. class CompilingMatcherTest extends TestCase
  15. {
  16. public function testMatch()
  17. {
  18. $this->assertTrue(CompilingMatcher::match(new Constraint('>=', '1'), Constraint::OP_EQ, '2'));
  19. }
  20. public function testCacheKey()
  21. {
  22. $this->assertFalse(CompilingMatcher::match(new Constraint('>=', '2.11'), Constraint::OP_EQ, '1.0'));
  23. $this->assertTrue(CompilingMatcher::match(new Constraint('>=', '2.1'), Constraint::OP_EQ, '11.0'));
  24. }
  25. }