From 1ed15d2b78df252a37d643bd59ea1a8bd61a3fff Mon Sep 17 00:00:00 2001 From: vagrant Date: Tue, 19 Jun 2018 21:51:55 +0200 Subject: [PATCH] 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. --- .../Magento/Cron/Observer/ProcessCronQueueObserverTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php b/dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php index 107bf8ae14bb9..6216cfb473628 100644 --- a/dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php @@ -27,7 +27,7 @@ protected function setUp() } /** - * @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr 8 * * * * + * @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr * * * * * */ public function testDispatchScheduled() { @@ -35,6 +35,7 @@ public function testDispatchScheduled() 'Magento\Cron\Model\ResourceModel\Schedule\Collection' ); $collection->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_PENDING); + $collection->addFieldToFilter('job_code', 'catalog_product_alert'); $this->assertGreaterThan(0, $collection->count(), 'Cron has failed to schedule tasks for itself for future.'); }