You are here

public function NameMungingTest::testUnMunge in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php \Drupal\KernelTests\Core\File\NameMungingTest::testUnMunge()

Ensure that unmunge gets your name back.

File

core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php, line 121

Class

NameMungingTest
Tests filename munging and unmunging.

Namespace

Drupal\KernelTests\Core\File

Code

public function testUnMunge() {
  $this
    ->expectDeprecation('file_unmunge_filename() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use str_replace() instead. See https://www.drupal.org/node/3032541');
  $munged_name = file_munge_filename($this->name, '', FALSE);
  $unmunged_name = file_unmunge_filename($munged_name);
  $this
    ->assertSame($unmunged_name, $this->name, new FormattableMarkup('The unmunged (%unmunged) filename matches the original (%original)', [
    '%unmunged' => $unmunged_name,
    '%original' => $this->name,
  ]));
}