Skip to content

Commit fae148b

Browse files
committed
Update test to run the same on EE and B2B
Exclude the staging group etc, not relevant for our test
1 parent def2562 commit fae148b

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ protected function setUp(): void
2727
$this->_model->execute(new \Magento\Framework\Event\Observer());
2828
}
2929

30-
// /**
31-
// * @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr * * * * *
32-
// */
33-
// public function testDispatchScheduled()
34-
// {
35-
// $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
36-
// \Magento\Cron\Model\ResourceModel\Schedule\Collection::class
37-
// );
38-
// $collection->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_PENDING);
39-
// $collection->addFieldToFilter('job_code', 'catalog_product_alert');
40-
// $this->assertGreaterThan(0, $collection->count(), 'Cron has failed to schedule tasks for itself for future.');
41-
// }
30+
/**
31+
* @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr * * * * *
32+
*/
33+
public function testDispatchScheduled()
34+
{
35+
$collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
36+
\Magento\Cron\Model\ResourceModel\Schedule\Collection::class
37+
);
38+
$collection->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_PENDING);
39+
$collection->addFieldToFilter('job_code', 'catalog_product_alert');
40+
$this->assertGreaterThan(0, $collection->count(), 'Cron has failed to schedule tasks for itself for future.');
41+
}
4242

4343
public function testDispatchNoFailed()
4444
{
@@ -107,11 +107,10 @@ public function testGroupFilters(array $expectedGroupsToRun, $group = null, $exc
107107
*/
108108
public function groupFiltersDataProvider(): array
109109
{
110-
$listOfGroups = array_reverse(array_keys($this->getFilterTestCronGroups()), true);
111110

112111
return [
113112
'no flags runs all groups' => [
114-
$listOfGroups // groups to run
113+
['consumers', 'index', 'default'] // groups to run
115114
],
116115
'--group=default should run' => [
117116
['default'], // groups to run
@@ -133,25 +132,19 @@ public function groupFiltersDataProvider(): array
133132
['default'], // --exclude-group default
134133
],
135134
'--exclude-group=index, all other groups should run' => [
136-
array_filter($listOfGroups, function ($g) {
137-
return $g !== 'index';
138-
}), // groups to run, all but index
139-
null, //
140-
['index'] // --exclude-group index
135+
['consumers', 'default'], // groups to run, all but index
136+
null, //
137+
['index'] // --exclude-group index
141138
],
142139
'--exclude-group for every group runs nothing' => [
143140
[], // groups to run, none
144141
null, //
145-
$listOfGroups // groups to exclude, all of them
142+
['default', 'consumers', 'index'] // groups to exclude, all of them
146143
],
147144
'exclude all groups but consumers, consumers runs' => [
148-
array_filter($listOfGroups, function ($g) {
149-
return $g === 'consumers';
150-
}),
145+
['consumers'],
151146
null,
152-
array_filter($listOfGroups, function ($g) {
153-
return $g !== 'consumers';
154-
})
147+
['index', 'default']
155148
],
156149
];
157150
}

0 commit comments

Comments
 (0)