function CallbackTest::testCallback

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

Test callback with valid "callable".

@dataProvider providerCallback

File

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

Class

CallbackTest
Tests the callback process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testCallback($callable) {
    $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.