@@ -44,6 +44,9 @@ public function provideCheckPassesForValidConstraintsData() : iterable
4444 $ v2_3_1_3 = '2.3.1-3-g878e2a42c ' ;
4545
4646 return [
47+ [$ v2_3_1_3 , '^2.3.1-2 ' ],
48+ [$ v2_3_1_3 , '^2.3.0-4 ' ],
49+ [$ v2_3_1_3 , '^2.3.1 ' ],
4750 [$ v2_3_1_3 , '^1|^2 ' ],
4851 [$ v2_3_1_3 , '^2 ' ],
4952
@@ -82,4 +85,58 @@ public function provideCheckPassesForValidConstraintsData() : iterable
8285 [$ v2_3_1_3 , '< 3 ' ],
8386 ];
8487 }
88+
89+ /**
90+ * @dataProvider provideCheckFailsForInvalidConstraintsData()
91+ */
92+ public function testCheckFailsForInvalidConstraints (string $ serverVersion , string $ constraints ) : void
93+ {
94+ $ mockClient = $ this ->getMockClientBuilder ()
95+ ->shouldHandle (
96+ new CallRequest ('box.info ' ), // $this->logicalOr()
97+ DummyFactory::createResponseFromData ([['version ' => $ serverVersion ]]))
98+ ->build ();
99+
100+ $ requirement = new TarantoolVersionRequirement ($ mockClient );
101+ $ errorMessage = sprintf ('Tarantool version %s is required ' , $ constraints );
102+
103+ self ::assertSame ($ errorMessage , $ requirement ->check ($ constraints ));
104+ }
105+
106+ public function provideCheckFailsForInvalidConstraintsData () : iterable
107+ {
108+ $ v2_3_1_3 = '2.3.1-3-g878e2a42c ' ;
109+
110+ return [
111+ [$ v2_3_1_3 , '^2.3.1-4 ' ],
112+ [$ v2_3_1_3 , '^3|^4 ' ],
113+ [$ v2_3_1_3 , '^3 ' ],
114+
115+ [$ v2_3_1_3 , '2.3.1-4 ' ],
116+ [$ v2_3_1_3 , '2.3.2 ' ],
117+ [$ v2_3_1_3 , '2.4 ' ],
118+ [$ v2_3_1_3 , '3 ' ],
119+
120+ [$ v2_3_1_3 , '>= 2.3.1-4 ' ],
121+ [$ v2_3_1_3 , '>= 2.3.2 ' ],
122+ [$ v2_3_1_3 , '>= 2.4 ' ],
123+ [$ v2_3_1_3 , '>= 3 ' ],
124+
125+ [$ v2_3_1_3 , '> 2.3.1-3 ' ],
126+ [$ v2_3_1_3 , '> 2.3.2 ' ],
127+ [$ v2_3_1_3 , '> 2.4 ' ],
128+ [$ v2_3_1_3 , '> 3 ' ],
129+
130+ [$ v2_3_1_3 , '<= 2.3.1-2 ' ],
131+ [$ v2_3_1_3 , '<= 2.3.1 ' ],
132+ [$ v2_3_1_3 , '<= 2.3.0 ' ],
133+ [$ v2_3_1_3 , '<= 2.3 ' ],
134+ [$ v2_3_1_3 , '<= 2 ' ],
135+
136+ [$ v2_3_1_3 , '< 2.3.1-3 ' ],
137+ [$ v2_3_1_3 , '< 2.3.1 ' ],
138+ [$ v2_3_1_3 , '< 2.3 ' ],
139+ [$ v2_3_1_3 , '< 2 ' ],
140+ ];
141+ }
85142}
0 commit comments