MatchAllConstraintTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Constraint;
  11. use PHPUnit\Framework\TestCase;
  12. class MatchAllConstraintTest extends TestCase
  13. {
  14. /**
  15. * @var Constraint
  16. */
  17. protected $versionProvide;
  18. /**
  19. * @var MatchAllConstraint
  20. */
  21. protected $matchAllConstraint;
  22. protected function setUp()
  23. {
  24. $this->versionProvide = new Constraint('==', '1.1');
  25. $this->matchAllConstraint = new MatchAllConstraint();
  26. }
  27. public function testMatches()
  28. {
  29. $result = $this->matchAllConstraint->matches($this->versionProvide);
  30. $this->assertTrue($result);
  31. }
  32. public function testGetPrettyString()
  33. {
  34. $expectedString = 'pretty-string';
  35. $this->matchAllConstraint->setPrettyString($expectedString);
  36. $result = $this->matchAllConstraint->getPrettyString();
  37. $this->assertSame($expectedString, $result);
  38. $expectedString = '*';
  39. $this->matchAllConstraint->setPrettyString(null);
  40. $result = $this->matchAllConstraint->getPrettyString();
  41. $this->assertSame($expectedString, $result);
  42. }
  43. }