You are here

protected function MachineNameControllerTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php \Drupal\Tests\system\Unit\Transliteration\MachineNameControllerTest::setUp()
  2. 9 core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php \Drupal\Tests\system\Unit\Transliteration\MachineNameControllerTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php, line 36

Class

MachineNameControllerTest
Tests that the machine name controller can transliterate strings as expected.

Namespace

Drupal\Tests\system\Unit\Transliteration

Code

protected function setUp() : void {
  parent::setUp();

  // Create the machine name controller.
  $this->tokenGenerator = $this
    ->prophesize(CsrfTokenGenerator::class);
  $this->tokenGenerator
    ->validate(Argument::cetera())
    ->will(function ($args) {
    return $args[0] === 'token-' . $args[1];
  });
  $this->machineNameController = new MachineNameController(new PhpTransliteration(), $this->tokenGenerator
    ->reveal());
}