You are here

protected function DedupeEntityTest::entityQueryExpects in Drupal 8

Helper function to add expectations to the mock entity query object.

Parameters

int $count: The number of deduplications to be set up.

1 call to DedupeEntityTest::entityQueryExpects()
DedupeEntityTest::testDedupe in core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php
Tests entity based deduplication based on providerTestDedupe() values.

File

core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php, line 160

Class

DedupeEntityTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\DedupeEntity @group migrate @group legacy

Namespace

Drupal\Tests\migrate\Unit\process

Code

protected function entityQueryExpects($count) {
  $this->entityQuery
    ->expects($this
    ->exactly($count + 1))
    ->method('condition')
    ->will($this
    ->returnValue($this->entityQuery));
  $this->entityQuery
    ->expects($this
    ->exactly($count + 1))
    ->method('count')
    ->will($this
    ->returnValue($this->entityQuery));
  $this->entityQuery
    ->expects($this
    ->exactly($count + 1))
    ->method('execute')
    ->will($this
    ->returnCallback(function () use (&$count) {
    return $count--;
  }));
}