function NullCoalesceTest::testTransformWithDefault

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::testTransformWithDefault()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::testTransformWithDefault()
  3. 10 core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::testTransformWithDefault()

Tests null_coalesce.

@covers ::transform

@dataProvider transformWithDefaultProvider

Parameters

array $source: The source value.

string $default_value: The default value.

mixed $expected_result: The expected result.

Throws

\Drupal\migrate\MigrateException

File

core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php, line 97

Class

NullCoalesceTest
Tests the null_coalesce process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testTransformWithDefault(array $source, $default_value, $expected_result) : void {
    $plugin = new NullCoalesce([
        'default_value' => $default_value,
    ], 'null_coalesce', []);
    $result = $plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame($expected_result, $result);
}

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