Skip to content

Commit 1ed15d2

Browse files
evktalogelanivishal
authored andcommitted
Filter test result collection with the cron job code defined in the config fixture. Set the schedule for every minute so that the job is scheduled regardless of the time when you run the test.
1 parent 9317c4f commit 1ed15d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ protected function setUp()
2727
}
2828

2929
/**
30-
* @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr 8 * * * *
30+
* @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr * * * * *
3131
*/
3232
public function testDispatchScheduled()
3333
{
3434
$collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
3535
'Magento\Cron\Model\ResourceModel\Schedule\Collection'
3636
);
3737
$collection->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_PENDING);
38+
$collection->addFieldToFilter('job_code', 'catalog_product_alert');
3839
$this->assertGreaterThan(0, $collection->count(), 'Cron has failed to schedule tasks for itself for future.');
3940
}
4041

0 commit comments

Comments
 (0)