Skip to content

Commit f99ac14

Browse files
authored
MCLOUD-7416: Fix validator for MariaDB (#30)
1 parent b1f0641 commit f99ac14

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

src/Service/Validator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ class Validator
3131
'>=2.4.0' => '>=7.3 <7.5', // '~7.3.0||~7.4.0'
3232
],
3333
ServiceInterface::NAME_DB_MARIA => [
34-
'<2.4.0' => '>=10.0 <10.3',
34+
'<2.3.6-p1' => '>=10.0 <10.3',
35+
'>=2.3.6-p1 <2.4.0' => '>=10.0 <10.4',
3536
'>=2.4.0' => '>=10.2 <10.5',
3637
],
3738
ServiceInterface::NAME_DB_MYSQL => [
3839
'<2.3.0' => '~5.6.0 || ~5.7.0',
3940
'>=2.3.0 <2.4.0' => '~5.7.0',
40-
'>=2.4.0' => '~8.0.0',
41+
'>=2.4.0' => '~5.7.0 || ~8.0.0',
4142
],
4243
ServiceInterface::NAME_DB_AURORA => [
4344
'<2.3.0' => '~1.0.0 || ~2.0.0',

src/Test/Unit/Service/ValidatorTest.php

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
namespace Magento\MagentoCloud\Test\Unit\Service;
99

10-
use Magento\MagentoCloud\Filesystem\Flag\ConfigurationMismatchException;
1110
use Magento\MagentoCloud\Package\MagentoVersion;
1211
use Magento\MagentoCloud\Package\UndefinedPackageException;
1312
use Magento\MagentoCloud\Service\ServiceInterface;
13+
use Magento\MagentoCloud\Service\ServiceMismatchException;
1414
use Magento\MagentoCloud\Service\Validator;
1515
use PHPUnit\Framework\MockObject\MockObject;
1616
use PHPUnit\Framework\TestCase;
@@ -44,8 +44,8 @@ protected function setUp()
4444
* @param string $magentoVersion
4545
* @param array $versions
4646
* @param int $errorsNumber
47-
* @throws ConfigurationMismatchException
4847
* @throws UndefinedPackageException
48+
* @throws ServiceMismatchException
4949
*
5050
* @dataProvider validateVersionsDataProvider
5151
*/
@@ -58,8 +58,8 @@ public function testValidateVersions(string $magentoVersion, array $versions, in
5858
}
5959

6060
/**
61-
* @throws ConfigurationMismatchException
6261
* @throws UndefinedPackageException
62+
* @throws \Magento\MagentoCloud\Service\ServiceMismatchException
6363
*/
6464
public function testValidateFailMessage()
6565
{
@@ -83,8 +83,8 @@ public function testValidateFailMessage()
8383
}
8484

8585
/**
86-
* @throws ConfigurationMismatchException
8786
* @throws UndefinedPackageException
87+
* @throws ServiceMismatchException
8888
*/
8989
public function testValidateNonexistentService()
9090
{
@@ -195,6 +195,27 @@ public function validateVersionsDataProvider(): array
195195
],
196196
1
197197
],
198+
[
199+
'2.4.1',
200+
[
201+
ServiceInterface::NAME_DB_MYSQL => '5.6',
202+
],
203+
1
204+
],
205+
[
206+
'2.4.1',
207+
[
208+
ServiceInterface::NAME_DB_MYSQL => '5.7',
209+
],
210+
0
211+
],
212+
[
213+
'2.4.1',
214+
[
215+
ServiceInterface::NAME_DB_MYSQL => '8.0',
216+
],
217+
0
218+
],
198219
[
199220
'2.4.2',
200221
[
@@ -212,13 +233,27 @@ public function validateVersionsDataProvider(): array
212233
'2.3.6',
213234
[
214235
ServiceInterface::NAME_PHP => '7.4', // wrong
215-
ServiceInterface::NAME_DB_MARIA => '10.2',
236+
ServiceInterface::NAME_DB_MARIA => '10.3', // wrong
216237
ServiceInterface::NAME_NGINX => '1.19',
217238
ServiceInterface::NAME_VARNISH => '6.2',
218239
ServiceInterface::NAME_REDIS => '5.0',
219240
ServiceInterface::NAME_ELASTICSEARCH => '7.9', //wrong
220241
],
221-
2
242+
3
243+
],
244+
[
245+
'2.3.6-p1',
246+
[
247+
ServiceInterface::NAME_DB_MARIA => '10.3',
248+
],
249+
0
250+
],
251+
[
252+
'2.3.6-p1',
253+
[
254+
ServiceInterface::NAME_DB_MARIA => '10.4', // wrong
255+
],
256+
1
222257
],
223258
[
224259
'2.3.7',

0 commit comments

Comments
 (0)