@@ -27,18 +27,18 @@ protected function setUp(): void
27
27
$ this ->_model ->execute (new \Magento \Framework \Event \Observer ());
28
28
}
29
29
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
+ }
42
42
43
43
public function testDispatchNoFailed ()
44
44
{
@@ -107,11 +107,10 @@ public function testGroupFilters(array $expectedGroupsToRun, $group = null, $exc
107
107
*/
108
108
public function groupFiltersDataProvider (): array
109
109
{
110
- $ listOfGroups = array_reverse (array_keys ($ this ->getFilterTestCronGroups ()), true );
111
110
112
111
return [
113
112
'no flags runs all groups ' => [
114
- $ listOfGroups // groups to run
113
+ [ ' consumers ' , ' index ' , ' default ' ] // groups to run
115
114
],
116
115
'--group=default should run ' => [
117
116
['default ' ], // groups to run
@@ -133,25 +132,19 @@ public function groupFiltersDataProvider(): array
133
132
['default ' ], // --exclude-group default
134
133
],
135
134
'--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
141
138
],
142
139
'--exclude-group for every group runs nothing ' => [
143
140
[], // groups to run, none
144
141
null , //
145
- $ listOfGroups // groups to exclude, all of them
142
+ [ ' default ' , ' consumers ' , ' index ' ] // groups to exclude, all of them
146
143
],
147
144
'exclude all groups but consumers, consumers runs ' => [
148
- array_filter ($ listOfGroups , function ($ g ) {
149
- return $ g === 'consumers ' ;
150
- }),
145
+ ['consumers ' ],
151
146
null ,
152
- array_filter ($ listOfGroups , function ($ g ) {
153
- return $ g !== 'consumers ' ;
154
- })
147
+ ['index ' , 'default ' ]
155
148
],
156
149
];
157
150
}
0 commit comments