class ConvertTokensTest
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Unit/Plugin/migrate/process/ConvertTokensTest.php \Drupal\Tests\user\Unit\Plugin\migrate\process\ConvertTokensTest
Tests the ConvertTokens plugin.
@group user
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase implements \Drupal\Tests\UnitTestCase
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase implements \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\user\Unit\Plugin\migrate\process\ConvertTokensTest implements \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase
- class \Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase implements \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase implements \Drupal\Tests\UnitTestCase
Expanded class hierarchy of ConvertTokensTest
File
-
core/
modules/ user/ tests/ src/ Unit/ Plugin/ migrate/ process/ ConvertTokensTest.php, line 13
Namespace
Drupal\Tests\user\Unit\Plugin\migrate\processView source
class ConvertTokensTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->plugin = new ConvertTokens([], 'convert_tokens', []);
}
/**
* Tests conversion of user 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);
}
/**
* Tests conversion of user tokens with a NULL value.
*/
public function testConvertTokensNull() {
$value = $this->plugin
->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
$this->assertEquals('', $value);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.