Skip to content

Commit

Permalink
MAGECLOUD-5117: Fix failing cron Functional Test (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
BaDos authored and shiftedreality committed Jan 28, 2020
1 parent 3a5d96d commit 3d1c570
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/Test/Functional/Acceptance/Cron22Cest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ protected function cronDataProvider(): array
],
],
],
[
'version' => '2.2.4',
'variables' => [
'MAGENTO_CLOUD_VARIABLES' => [
'ADMIN_EMAIL' => '[email protected]',
'ADMIN_LOCALE' => 'ar_KW'
],
],
],
[
'version' => '2.2.5',
'variables' => [
Expand Down
13 changes: 11 additions & 2 deletions src/Test/Functional/Acceptance/CronCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
);
}

/**
Expand Down

0 comments on commit 3d1c570

Please sign in to comment.