Skip to content

Commit d092414

Browse files
Merge pull request #44 from DmitryFurs/fix-broken-cron-job-count-aggregator
Fix BrokenCronJobCountAggregator
2 parents 89e3241 + 7007200 commit d092414

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Test/Unit/Aggregator/Cronjob/BrokenCronJobCountAggregatorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ public function testAggregate()
4343
{
4444
$this->collection
4545
->expects($this->at(0))
46-
->method('addFilter')
46+
->method('addFieldToFilter')
4747
->with(...['status', 'pending'])
4848
->willReturn($this->collection);
4949
$this->collection
5050
->expects($this->at(1))
51-
->method('addFilter')
52-
->with(...['executed_at', 'NULL', 'IS NOT'])
51+
->method('addFieldToFilter')
52+
->with(...['executed_at', ['notnull' => true]])
5353
->willReturn($this->collection);
5454
$this->collection
5555
->expects($this->at(2))
56-
->method('addFilter')
57-
->with(...['finished_at', 'NULL', 'IS'])
56+
->method('addFieldToFilter')
57+
->with(...['finished_at', ['null' => true]])
5858
->willReturn($this->collection);
5959

6060
$this->collection

Test/Unit/Aggregator/Cronjob/CronJobCountAggregatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CronJobCountAggregatorTest extends TestCase
2727
/** @var MockObject|Collection */
2828
private $collection;
2929

30-
/** @var BrokenCronJobCountAggregator */
30+
/** @var CronJobCountAggregator */
3131
private $sut;
3232

3333
public function setUp(): void

src/Aggregator/CronJob/BrokenCronJobCountAggregator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public function aggregate(): bool
4747
{
4848
/** @var Collection $collection */
4949
$collection = $this->cronCollectionFactory->create();
50-
$collection->addFilter('status', Schedule::STATUS_PENDING)
51-
->addFilter('executed_at', 'NULL', 'IS NOT')
52-
->addFilter('finished_at', 'NULL', 'IS');
50+
$collection->addFieldToFilter('status', Schedule::STATUS_PENDING)
51+
->addFieldToFilter('executed_at', ['notnull' => true])
52+
->addFieldToFilter('finished_at', ['null' => true]);
5353
$this->updateMetricService->update($this->getCode(), (string)$collection->count());
5454

5555
return true;

0 commit comments

Comments
 (0)