Skip to content

Commit f66c0a0

Browse files
author
Yevhen Miroshnychenko
authored
MAGECLOUD-5394: Fix functional and static tests for 2002.0 branch (#691)
1 parent a475153 commit f66c0a0

File tree

7 files changed

+25
-40
lines changed

7 files changed

+25
-40
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ install:
5555
- if [ $TRAVIS_SECURE_ENV_VARS == "true" ]; then composer config http-basic.repo.magento.com ${REPO_USERNAME} ${REPO_PASSWORD}; fi;
5656
- if [ $TRAVIS_SECURE_ENV_VARS == "true" ]; then composer config github-oauth.github.com ${GITHUB_TOKEN}; fi;
5757
- if [ -n "${MCP_VERSION}" ]; then composer config repositories.mcp git git@github.com:magento/magento-cloud-patches.git && composer require "magento/magento-cloud-patches:${MCP_VERSION}" --no-update; fi;
58+
- if [ -n "${MCC_VERSION}" ]; then composer config repositories.mcc git git@github.com:magento/magento-cloud-components.git && composer require "magento/magento-cloud-components:${MCC_VERSION}" --no-update; fi;
5859
- composer update -n --no-suggest
5960

6061
before_script:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"squizlabs/php_codesniffer": "^3.0",
4141
"codeception/codeception": "^2.5.3",
4242
"consolidation/robo": "^1.2",
43-
"phpstan/phpstan": "@stable"
43+
"phpstan/phpstan": "<0.12"
4444
},
4545
"conflict": {
4646
"nesbot/carbon": ">=1.38 <2.0"

src/Test/Functional/Acceptance/Cron21Cest.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,6 @@ protected function cronDataProvider(): array
2727
],
2828
],
2929
],
30-
[
31-
'version' => '2.1.6',
32-
'variables' => [
33-
'MAGENTO_CLOUD_VARIABLES' => [
34-
'ADMIN_EMAIL' => 'admin@example.com',
35-
'ADMIN_LOCALE' => 'ar_KW'
36-
],
37-
],
38-
],
39-
[
40-
'version' => '2.1.11',
41-
'variables' => [
42-
'MAGENTO_CLOUD_VARIABLES' => [
43-
'ADMIN_EMAIL' => 'admin@example.com',
44-
'ADMIN_LOCALE' => 'fr_FR'
45-
],
46-
],
47-
],
48-
[
49-
'version' => '2.1.14',
50-
'variables' => [
51-
'MAGENTO_CLOUD_VARIABLES' => [
52-
'ADMIN_EMAIL' => 'admin@example.com',
53-
'ADMIN_LOCALE' => 'ar_KW'
54-
],
55-
],
56-
],
57-
[
58-
'version' => '2.1.15',
59-
'variables' => [
60-
'MAGENTO_CLOUD_VARIABLES' => [
61-
'ADMIN_EMAIL' => 'admin@example.com',
62-
'ADMIN_LOCALE' => 'ar_KW'
63-
],
64-
],
65-
],
6630
];
6731
}
6832
}

src/Test/Functional/Acceptance/CronCest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testCron(\CliTester $I, \Codeception\Example $data)
3333
$I->assertTrue($I->runEceToolsCommand('post-deploy', Docker::DEPLOY_CONTAINER, $data['variables']));
3434
$I->deleteFromDatabase('cron_schedule');
3535
$I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER));
36+
$I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER));
3637

3738
$this->checkCronJobForLocale($I, 'cron_test_job_timeformat', 5);
3839
$this->checkCronJobForLocale($I, 'cron_test_job_timeformat_six', 6);
@@ -50,10 +51,16 @@ public function testCron(\CliTester $I, \Codeception\Example $data)
5051

5152
$I->updateInDatabase('cron_schedule', ['scheduled_at' => date('Y-m-d H:i:s')], ['status' => 'pending']);
5253

54+
$I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER));
5355
$I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER));
5456

5557
$successfulJobs2 = $I->grabNumRecords('cron_schedule', ['job_code' => 'cron_test_job', 'status' => 'success']);
56-
$I->assertEquals($successfulJobs1, $successfulJobs2, 'Number of successful jobs changed');
58+
59+
if (version_compare($data['version'], '2.2.5', '<')) {
60+
$I->assertEquals($successfulJobs1, $successfulJobs2, 'Number of successful jobs changed');
61+
} else {
62+
$I->assertGreaterThan($successfulJobs1, $successfulJobs2, 'Number of successful jobs did not change');
63+
}
5764

5865
$I->updateInDatabase(
5966
'cron_schedule',
@@ -74,7 +81,11 @@ public function testCron(\CliTester $I, \Codeception\Example $data)
7481
$I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER));
7582

7683
$successfulJobs3 = $I->grabNumRecords('cron_schedule', ['job_code' => 'cron_test_job', 'status' => 'success']);
77-
$I->assertGreaterThan($successfulJobs1, $successfulJobs3, 'Number of successful jobs did not change');
84+
$I->assertGreaterThan(
85+
version_compare($data['version'], '2.2.5', '<') ? $successfulJobs1 : $successfulJobs2,
86+
$successfulJobs3,
87+
'Number of successful jobs did not change'
88+
);
7889
}
7990

8091
/**

src/Test/Functional/Acceptance/Upgrade21Cest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Upgrade21Cest extends UpgradeCest
1818
protected function testProvider()
1919
{
2020
return [
21-
['from' => '2.1.12', 'to' => '2.2.0']
21+
['from' => '2.1.4', 'to' => '2.2.0']
2222
];
2323
}
2424
}

tests/functional/Codeception/Docker.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,13 @@ public function addEceComposerRepo(): bool
295295
'repo' => [
296296
'type' => 'vcs',
297297
'url' => 'git@github.com:magento/magento-cloud-patches.git'
298+
],
299+
],
300+
'mcc' => [
301+
'name' => 'magento/magento-cloud-components',
302+
'repo' => [
303+
'type' => 'vcs',
304+
'url' => 'git@github.com:magento/magento-cloud-components.git'
298305
]
299306
]
300307
];

tests/static/phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ parameters:
99
path: %currentWorkingDirectory%/src/StaticContent/ThemeResolver.php
1010
- message: "#Strict comparison using === between bool and null will always evaluate to false.#"
1111
path: %currentWorkingDirectory%/src/Filesystem/Driver/File.php
12+
- message: "#should return int but returns null#"
13+
path: %currentWorkingDirectory%/src/Command/DbDump.php

0 commit comments

Comments
 (0)