You are here

protected function DedupeEntityTest::entityQueryExpects in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php \Drupal\Tests\migrate\Unit\process\DedupeEntityTest::entityQueryExpects()

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 156
Contains \Drupal\Tests\migrate\Unit\process\DedupeEntityTest.

Class

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

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--;
  }));
}