
| Current Path : /var/www/html1/bbp/web/modules/contrib/migrate_plus/tests/src/Unit/process/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/bbp/web/modules/contrib/migrate_plus/tests/src/Unit/process/TransliterationTest.php |
<?php
namespace Drupal\Tests\migrate_plus\Unit\process;
use Drupal\Component\Transliteration\PhpTransliteration;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\migrate_plus\Plugin\migrate\process\Transliteration;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
* Tests the transliteration process plugin.
*
* @group migrate_plus
*/
class TransliterationTest extends MigrateProcessTestCase {
/**
* A transliteration instance.
*
* @var \Drupal\Component\Transliteration\TransliterationInterface
*/
protected $transliteration;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
$this->transliteration = new PhpTransliteration();
$this->row = $this->getMockBuilder(Row::class)
->disableOriginalConstructor()
->getMock();
$this->migrateExecutable = $this->getMockBuilder(MigrateExecutableInterface::class)
->disableOriginalConstructor()
->getMock();
parent::setUp();
}
/**
* Tests transliteration transformation of non-alphanumeric characters.
*/
public function testTransform(): void {
$actual = '9000004351_53494854_Spøgelsesjægerneáéö';
$expected_result = '9000004351_53494854_Spogelsesjaegerneaeo';
$plugin = new Transliteration([], 'transliteration', [], $this->transliteration);
$value = $plugin->transform($actual, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertEquals($expected_result, $value);
}
}