19 declare(strict_types=1);
26 protected Data\Factory
$f;
28 protected function setUp(): void
30 $this->f =
new Data\Factory();
35 $v = $this->f->version(
"0.1.0");
37 $this->assertEquals(
"0.1.0", (
string) $v);
42 $v = $this->f->version(
"1");
44 $this->assertEquals(
"1.0.0", (
string) $v);
49 $v = $this->f->version(
"1.2");
51 $this->assertEquals(
"1.2.0", (
string) $v);
56 $v = $this->f->version(
"1.2.3");
58 $this->assertEquals(1, $v->getMajor());
59 $this->assertEquals(2, $v->getMinor());
60 $this->assertEquals(3, $v->getPatch());
68 $this->assertTrue($l->isGreaterThan($r));
69 $this->assertFalse($l->isSmallerThan($r));
70 $this->assertTrue($r->isSmallerThan($l));
71 $this->assertFalse($r->isGreaterThan($l));
72 $this->assertTrue($l->isGreaterThanOrEquals($r));
73 $this->assertFalse($l->isSmallerThanOrEquals($r));
74 $this->assertTrue($r->isSmallerThanOrEquals($l));
75 $this->assertFalse($r->isGreaterThanOrEquals($l));
76 $this->assertFalse($l->equals($r));
77 $this->assertFalse($r->equals($l));
82 $f =
new Data\Factory();
84 'Patch version is greater (2>1), major and minor versions are equal (0)' => [$f->version(
"0.0.2"), $f->version(
"0.0.1")],
85 'Minor version is greater (2>1), major and patch versions are equal (0)' => [$f->version(
"0.2.0"), $f->version(
"0.1.0")],
86 'Major version is greater (2>1), minor and patch versions are equal (0)' => [$f->version(
"2.0.0"), $f->version(
"1.0.0")],
87 'Patch version is greater (3>2), major (1) and minor (2) versions are equal' => [$f->version(
"1.2.3"), $f->version(
"1.2.2")],
88 'Minor version is greater (2>1), major (1) and patch (3) versions are equal' => [$f->version(
"1.2.3"), $f->version(
"1.1.3")],
89 'Major version is greater (1>0), minor (2) and patch (3) versions are equal' => [$f->version(
"1.2.3"), $f->version(
"0.2.3")],
90 'Minor version is greater (5>1), patch is smaller (0<1), minor version is equal (1)' => [$f->version(
"1.5.0"), $f->version(
"1.1.1")],
99 $this->assertFalse($l->isGreaterThan($r));
100 $this->assertFalse($r->isSmallerThan($l));
101 $this->assertTrue($l->isGreaterThanOrEquals($r));
102 $this->assertTrue($l->isSmallerThanOrEquals($r));
103 $this->assertTrue($r->isSmallerThanOrEquals($l));
104 $this->assertTrue($r->isGreaterThanOrEquals($l));
105 $this->assertTrue($l->equals($r));
106 $this->assertTrue($r->equals($l));
111 $f =
new Data\Factory();
113 [$f->version(
"0.0.1"), $f->version(
"0.0.1")],
114 [$f->version(
"0.1.0"), $f->version(
"0.1.0")],
115 [$f->version(
"1.0.0"), $f->version(
"1.0.0")],
116 [$f->version(
"1.0.3"), $f->version(
"1.0.3")],
117 [$f->version(
"1.2.0"), $f->version(
"1.2.0")],
118 [$f->version(
"1.2.3"), $f->version(
"1.2.3")]
static greaterThanProvider()
testGreaterThan(Data\Version $l, Data\Version $r)
greaterThanProvider
testEquals(Data\Version $l, Data\Version $r)
equalsProvider
A version number that consists of three numbers (major, minor, patch).