function StubSourceGeneratorPlugin::initializeIterator

Same name in other branches
  1. 8.9.x 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 548

Class

StubSourceGeneratorPlugin
Defines a stubbed source plugin with a generator as iterator.

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.