PreReleaseSuffixTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace PharIo\Version;
  3. use PHPUnit\Framework\TestCase;
  4. /**
  5. * @covers \PharIo\Version\PreReleaseSuffix
  6. */
  7. class PreReleaseSuffixTest extends TestCase {
  8. /**
  9. * @dataProvider greaterThanProvider
  10. *
  11. * @param string $leftSuffixValue
  12. * @param string $rightSuffixValue
  13. * @param bool $expectedResult
  14. */
  15. public function testGreaterThanReturnsExpectedResult(
  16. $leftSuffixValue,
  17. $rightSuffixValue,
  18. $expectedResult
  19. ) {
  20. $leftSuffix = new PreReleaseSuffix($leftSuffixValue);
  21. $rightSuffix = new PreReleaseSuffix($rightSuffixValue);
  22. $this->assertSame($expectedResult, $leftSuffix->isGreaterThan($rightSuffix));
  23. }
  24. public function greaterThanProvider() {
  25. return [
  26. ['alpha1', 'alpha2', false],
  27. ['alpha2', 'alpha1', true],
  28. ['beta1', 'alpha3', true],
  29. ['b1', 'alpha3', true],
  30. ['b1', 'a3', true],
  31. ['dev1', 'alpha2', false],
  32. ['dev1', 'alpha2', false],
  33. ['alpha2', 'dev5', true],
  34. ['rc1', 'beta2', true],
  35. ['patch5', 'rc7', true],
  36. ['alpha1', 'alpha.2', false],
  37. ['alpha.3', 'alpha2', true],
  38. ['alpha.3', 'alpha.2', true],
  39. ];
  40. }
  41. }