function StubSourceGeneratorPlugin::initializeIterator

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSourceTest.php \Drupal\Tests\migrate\Unit\StubSourceGeneratorPlugin::initializeIterator()
  2. 10 core/modules/migrate/tests/src/Unit/MigrateSourceTest.php \Drupal\Tests\migrate\Unit\StubSourceGeneratorPlugin::initializeIterator()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrateSourceTest.php \Drupal\Tests\migrate\Unit\StubSourceGeneratorPlugin::initializeIterator()

Overrides StubSourcePlugin::initializeIterator

File

core/modules/migrate/tests/src/Unit/MigrateSourceTest.php, line 544

Class

StubSourceGeneratorPlugin
Stubbed source plugin with a generator as iterator. Also it overwrites the $skipCount, $cacheCounts and $trackChanges properties.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function initializeIterator() {
    $data = [
        [
            'title' => 'foo',
        ],
        [
            'title' => 'bar',
        ],
        [
            'title' => 'iggy',
        ],
    ];
    foreach ($data as $row) {
        (yield $row);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.