From 3d1c570033217b40f67102e00198f1a7b483ceb5 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 27 Jan 2020 19:32:10 -0600 Subject: [PATCH] MAGECLOUD-5117: Fix failing cron Functional Test (#672) --- src/Test/Functional/Acceptance/Cron22Cest.php | 9 +++++++++ src/Test/Functional/Acceptance/CronCest.php | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Test/Functional/Acceptance/Cron22Cest.php b/src/Test/Functional/Acceptance/Cron22Cest.php index 1544693f05..6e38fa1fc3 100644 --- a/src/Test/Functional/Acceptance/Cron22Cest.php +++ b/src/Test/Functional/Acceptance/Cron22Cest.php @@ -27,6 +27,15 @@ protected function cronDataProvider(): array ], ], ], + [ + 'version' => '2.2.4', + 'variables' => [ + 'MAGENTO_CLOUD_VARIABLES' => [ + 'ADMIN_EMAIL' => 'admin@example.com', + 'ADMIN_LOCALE' => 'ar_KW' + ], + ], + ], [ 'version' => '2.2.5', 'variables' => [ diff --git a/src/Test/Functional/Acceptance/CronCest.php b/src/Test/Functional/Acceptance/CronCest.php index d86dd1ab66..6f08e1680a 100644 --- a/src/Test/Functional/Acceptance/CronCest.php +++ b/src/Test/Functional/Acceptance/CronCest.php @@ -55,7 +55,12 @@ public function testCron(\CliTester $I, \Codeception\Example $data) $I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER)); $successfulJobs2 = $I->grabNumRecords('cron_schedule', ['job_code' => 'cron_test_job', 'status' => 'success']); - $I->assertEquals($successfulJobs1, $successfulJobs2, 'Number of successful jobs changed'); + + if (version_compare($data['version'], '2.2.5', '<')) { + $I->assertEquals($successfulJobs1, $successfulJobs2, 'Number of successful jobs changed'); + } else { + $I->assertGreaterThan($successfulJobs1, $successfulJobs2, 'Number of successful jobs did not change'); + } $I->updateInDatabase( 'cron_schedule', @@ -76,7 +81,11 @@ public function testCron(\CliTester $I, \Codeception\Example $data) $I->assertTrue($I->runBinMagentoCommand('cron:run', Docker::DEPLOY_CONTAINER)); $successfulJobs3 = $I->grabNumRecords('cron_schedule', ['job_code' => 'cron_test_job', 'status' => 'success']); - $I->assertGreaterThan($successfulJobs1, $successfulJobs3, 'Number of successful jobs did not change'); + $I->assertGreaterThan( + version_compare($data['version'], '2.2.5', '<') ? $successfulJobs1 : $successfulJobs2, + $successfulJobs3, + 'Number of successful jobs did not change' + ); } /**