You are here

public function NameMungingTest::testMungeIgnoreAllowedExtensions in Drupal 8

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

Tests that allowed extensions are ignored by file_munge_filename().

File

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

Class

NameMungingTest
Tests filename munging and unmunging.

Namespace

Drupal\KernelTests\Core\File

Code

public function testMungeIgnoreAllowedExtensions() {

  // Declare that our extension is allowed. The declared extensions should be
  // case insensitive, so test using one with a different case.
  $munged_name = file_munge_filename($this->nameWithUcExt, $this->badExtension);
  $this
    ->assertSame($munged_name, $this->nameWithUcExt);

  // The allowed extensions should also be normalized.
  $munged_name = file_munge_filename($this->name, strtoupper($this->badExtension));
  $this
    ->assertSame($munged_name, $this->name);
}