ConvertTokensTest.php in Drupal 8
File
core/modules/user/tests/src/Unit/Plugin/migrate/process/ConvertTokensTest.php
View source
<?php
namespace Drupal\Tests\user\Unit\Plugin\migrate\process;
use Drupal\user\Plugin\migrate\process\ConvertTokens;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
class ConvertTokensTest extends MigrateProcessTestCase {
protected function setUp() {
parent::setUp();
$this->plugin = new ConvertTokens([], 'convert_tokens', []);
}
public function testConvertTokens() {
$value = $this->plugin
->transform('Account details for !username at !site', $this->migrateExecutable, $this->row, 'destination_property');
$this
->assertEquals('Account details for [user:name] at [site:name]', $value);
}
public function testConvertTokensNull() {
$value = $this->plugin
->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
$this
->assertEquals('', $value);
}
}