function CallbackTest::testCallback

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

Tests callback with valid "callable".

@dataProvider providerCallback

File

core/modules/migrate/tests/src/Unit/process/CallbackTest.php, line 22

Class

CallbackTest
Tests the callback process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testCallback($callable) : void {
    $configuration = [
        'callable' => $callable,
    ];
    $this->plugin = new Callback($configuration, 'map', []);
    $value = $this->plugin
        ->transform('FooBar', $this->migrateExecutable, $this->row, 'destination_property');
    $this->assertSame('foobar', $value);
}

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