function it_is_countable(CursorInterface $cursor) { $this->shouldImplement('\\Countable'); $cursor->count()->shouldBeCalled()->willReturn(13); // page size is 10 : so 1 page of 10 elements and a second of 3 $this->shouldHaveCount(2); }
/** * {@inheritdoc} */ public function read() { $product = null; if ($this->products->valid()) { $product = $this->products->current(); $this->stepExecution->incrementSummaryInfo('read'); $this->products->next(); } if (null !== $product) { $channel = $this->getConfiguredChannel(); if (null !== $channel) { $this->metricConverter->convert($product, $channel); } } return $product; }
/** * {@inheritdoc} */ public function read() { $configuration = $this->getJobConfiguration(); if (null === $configuration) { return null; } if (!$this->isExecuted) { $this->isExecuted = true; $this->products = $this->getProductsCursor($configuration['filters']); } $result = $this->products->current(); if (!empty($result)) { $this->stepExecution->incrementSummaryInfo('read'); $this->products->next(); } else { $result = null; } return $result; }
function it_returns_the_number_of_versions_to_be_purged($versionRepository, CursorInterface $cursor) { $cursor->count()->willReturn(1); $versionRepository->findPotentiallyPurgeableBy(Argument::type('array'))->willReturn($cursor); $this->getVersionsToPurgeCount([])->shouldReturn(1); }