CallbackTest.php in Zircon Profile 8.0
File
core/modules/migrate/tests/src/Unit/process/CallbackTest.php
View source
<?php
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\Plugin\migrate\process\Callback;
class CallbackTest extends MigrateProcessTestCase {
protected function setUp() {
$this->plugin = new TestCallback();
parent::setUp();
}
public function testCallbackWithFunction() {
$this->plugin
->setCallable('strtolower');
$value = $this->plugin
->transform('FooBar', $this->migrateExecutable, $this->row, 'destinationproperty');
$this
->assertSame($value, 'foobar');
}
public function testCallbackWithClassMethod() {
$this->plugin
->setCallable(array(
'\\Drupal\\Component\\Utility\\Unicode',
'strtolower',
));
$value = $this->plugin
->transform('FooBar', $this->migrateExecutable, $this->row, 'destinationproperty');
$this
->assertSame($value, 'foobar');
}
}
class TestCallback extends Callback {
public function __construct() {
}
public function setCallable($callable) {
$this->configuration['callable'] = $callable;
}
}