You are here

public function NullCoalesceTest::testTransformWithDefault in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/process/NullCoalesceTest.php \Drupal\Tests\migrate\Unit\process\NullCoalesceTest::testTransformWithDefault()
  2. 9 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 95

Class

NullCoalesceTest
Tests the null_coalesce process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

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