public function FilenameTransliterationTest::testFileTransliteration in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
- 8.2 modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
- 8.3 modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
- 8.4 modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
- 6.0.x modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
- 6.1.x modules/thunder_media/tests/src/Functional/FilenameTransliterationTest.php \Drupal\Tests\thunder_media\Functional\FilenameTransliterationTest::testFileTransliteration()
Test for transliteration of file name.
File
- modules/
thunder_media/ tests/ src/ Functional/ FilenameTransliterationTest.php, line 39
Class
- FilenameTransliterationTest
- Tests for transliteration of file names.
Namespace
Drupal\Tests\thunder_media\FunctionalCode
public function testFileTransliteration() {
$account = $this
->drupalCreateUser([
'access site reports',
]);
$this
->drupalLogin($account);
if (file_exists('core/tests/fixtures/files/image-1.png')) {
\Drupal::service('file_system')
->copy('core/tests/fixtures/files/image-1.png', PublicStream::basePath() . '/foo°.png');
}
else {
// Needed for min testing.
$original = drupal_get_path('module', 'simpletest') . '/files';
\Drupal::service('file_system')
->copy($original . '/image-1.png', PublicStream::basePath() . '/foo°.png');
}
// Upload with replace to guarantee there's something there.
$edit = [
'file_test_replace' => FileSystemInterface::EXISTS_RENAME,
'files[file_test_upload]' => \Drupal::service('file_system')
->realpath('public://foo°.png'),
];
$this
->drupalGet('file-test/upload');
$this
->submitForm($edit, $this
->t('Submit'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('You WIN!');
$this
->assertTrue(file_exists('temporary://foodeg.png'));
$max_fid_after = \Drupal::database()
->query('SELECT MAX(fid) AS fid FROM {file_managed}')
->fetchField();
$file = File::load($max_fid_after);
$this
->assertSame('foodeg.png', $file
->getFilename());
$this
->assertSame('temporary://foodeg.png', $file
->getFileUri());
}