From 70072007cd96764c5e1abf7ae43465717110c2a3 Mon Sep 17 00:00:00 2001 From: Dmitry Furs Date: Mon, 4 Nov 2024 13:01:26 +0100 Subject: [PATCH] Fix BrokenCronJobCountAggregator --- .../Cronjob/BrokenCronJobCountAggregatorTest.php | 10 +++++----- .../Aggregator/Cronjob/CronJobCountAggregatorTest.php | 2 +- .../CronJob/BrokenCronJobCountAggregator.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Test/Unit/Aggregator/Cronjob/BrokenCronJobCountAggregatorTest.php b/Test/Unit/Aggregator/Cronjob/BrokenCronJobCountAggregatorTest.php index c5024f4..fa3bbb2 100644 --- a/Test/Unit/Aggregator/Cronjob/BrokenCronJobCountAggregatorTest.php +++ b/Test/Unit/Aggregator/Cronjob/BrokenCronJobCountAggregatorTest.php @@ -43,18 +43,18 @@ public function testAggregate() { $this->collection ->expects($this->at(0)) - ->method('addFilter') + ->method('addFieldToFilter') ->with(...['status', 'pending']) ->willReturn($this->collection); $this->collection ->expects($this->at(1)) - ->method('addFilter') - ->with(...['executed_at', 'NULL', 'IS NOT']) + ->method('addFieldToFilter') + ->with(...['executed_at', ['notnull' => true]]) ->willReturn($this->collection); $this->collection ->expects($this->at(2)) - ->method('addFilter') - ->with(...['finished_at', 'NULL', 'IS']) + ->method('addFieldToFilter') + ->with(...['finished_at', ['null' => true]]) ->willReturn($this->collection); $this->collection diff --git a/Test/Unit/Aggregator/Cronjob/CronJobCountAggregatorTest.php b/Test/Unit/Aggregator/Cronjob/CronJobCountAggregatorTest.php index f0f2dc0..1ba1a79 100644 --- a/Test/Unit/Aggregator/Cronjob/CronJobCountAggregatorTest.php +++ b/Test/Unit/Aggregator/Cronjob/CronJobCountAggregatorTest.php @@ -27,7 +27,7 @@ class CronJobCountAggregatorTest extends TestCase /** @var MockObject|Collection */ private $collection; - /** @var BrokenCronJobCountAggregator */ + /** @var CronJobCountAggregator */ private $sut; public function setUp(): void diff --git a/src/Aggregator/CronJob/BrokenCronJobCountAggregator.php b/src/Aggregator/CronJob/BrokenCronJobCountAggregator.php index ac7c6c2..2cf8815 100644 --- a/src/Aggregator/CronJob/BrokenCronJobCountAggregator.php +++ b/src/Aggregator/CronJob/BrokenCronJobCountAggregator.php @@ -47,9 +47,9 @@ public function aggregate(): bool { /** @var Collection $collection */ $collection = $this->cronCollectionFactory->create(); - $collection->addFilter('status', Schedule::STATUS_PENDING) - ->addFilter('executed_at', 'NULL', 'IS NOT') - ->addFilter('finished_at', 'NULL', 'IS'); + $collection->addFieldToFilter('status', Schedule::STATUS_PENDING) + ->addFieldToFilter('executed_at', ['notnull' => true]) + ->addFieldToFilter('finished_at', ['null' => true]); $this->updateMetricService->update($this->getCode(), (string)$collection->count()); return true;