No Description

SpecificMajorAndMinorVersionConstraintTest.php 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\SpecificMajorAndMinorVersionConstraint
  14. */
  15. class SpecificMajorAndMinorVersionConstraintTest extends TestCase {
  16. public function versionProvider() {
  17. return [
  18. // compliant versions
  19. [1, 0, new Version('1.0.2'), true],
  20. [1, 0, new Version('1.0.3'), true],
  21. [1, 1, new Version('1.1.1'), true],
  22. // non-compliant versions
  23. [2, 9, new Version('0.9.9'), false],
  24. [3, 2, new Version('2.2.3'), false],
  25. [2, 8, new Version('2.9.9'), false],
  26. ];
  27. }
  28. /**
  29. * @dataProvider versionProvider
  30. *
  31. * @param int $major
  32. * @param int $minor
  33. * @param Version $version
  34. * @param bool $expectedResult
  35. */
  36. public function testReturnsTrueForCompliantVersions($major, $minor, Version $version, $expectedResult) {
  37. $constraint = new SpecificMajorAndMinorVersionConstraint('foo', $major, $minor);
  38. $this->assertSame($expectedResult, $constraint->complies($version));
  39. }
  40. }