Nessuna descrizione

PreReleaseSuffixTest.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. }