function SkipOnEmptyTest::testMultipleTransforms

Same name in other branches
  1. 10 core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php \Drupal\Tests\migrate\Unit\process\SkipOnEmptyTest::testMultipleTransforms()

Tests repeated execution of a process plugin can reset the pipeline stoppage correctly.

File

core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php, line 94

Class

SkipOnEmptyTest
Tests the skip on empty process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMultipleTransforms() : void {
    $configuration['method'] = 'process';
    $plugin = new SkipOnEmpty($configuration, 'skip_on_empty', []);
    // Confirm transform will stop the pipeline.
    $value = $plugin->transform('', $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertNull($value);
    $this->assertTrue($plugin->isPipelineStopped());
    // Restart the pipeline and test again.
    $plugin->reset();
    $this->assertFalse($plugin->isPipelineStopped());
    $value = $plugin->transform(' ', $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame(' ', $value);
    $this->assertFalse($plugin->isPipelineStopped());
}

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