Geen omschrijving

GreaterThanOrEqualToVersionConstraintTest.php 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of PharIo\Version.
  4. *
  5. * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace PharIo\Version;
  11. use PHPUnit\Framework\TestCase;
  12. /**
  13. * @covers \PharIo\Version\GreaterThanOrEqualToVersionConstraint
  14. */
  15. class GreaterThanOrEqualToVersionConstraintTest extends TestCase {
  16. public function versionProvider() {
  17. return [
  18. // compliant versions
  19. [new Version('1.0.2'), new Version('1.0.2'), true],
  20. [new Version('1.0.2'), new Version('1.0.3'), true],
  21. [new Version('1.0.2'), new Version('1.1.1'), true],
  22. [new Version('1.0.2'), new Version('2.0.0'), true],
  23. [new Version('1.0.2'), new Version('1.0.3'), true],
  24. // non-compliant versions
  25. [new Version('1.0.2'), new Version('1.0.1'), false],
  26. [new Version('1.9.8'), new Version('0.9.9'), false],
  27. [new Version('2.3.1'), new Version('2.2.3'), false],
  28. [new Version('3.0.2'), new Version('2.9.9'), false],
  29. ];
  30. }
  31. /**
  32. * @dataProvider versionProvider
  33. *
  34. * @param Version $constraintVersion
  35. * @param Version $version
  36. * @param bool $expectedResult
  37. */
  38. public function testReturnsTrueForCompliantVersions(Version $constraintVersion, Version $version, $expectedResult) {
  39. $constraint = new GreaterThanOrEqualToVersionConstraint('foo', $constraintVersion);
  40. $this->assertSame($expectedResult, $constraint->complies($version));
  41. }
  42. }