public function FileFieldPathsTransliterationTest::testUi in File (Field) Paths 8
Test File (Field) Paths Transliteration UI.
File
- tests/
src/ Functional/ FileFieldPathsTransliterationTest.php, line 17
Class
- FileFieldPathsTransliterationTest
- Test transliteration functionality.
Namespace
Drupal\Tests\filefield_paths\FunctionalCode
public function testUi() {
// Create a File field.
$field_name = mb_strtolower($this
->randomMachineName());
$this
->createFileField($field_name, 'node', $this->contentType);
// Ensure File (Field) Paths Transliteration settings are present and
// available.
$this
->drupalGet("admin/structure/types/manage/{$this->contentType}/fields/node.{$this->contentType}.{$field_name}");
foreach ([
'path',
'name',
] as $field) {
// Transliteration checkbox is present in File settings.
$this
->assertField("third_party_settings[filefield_paths][file_{$field}][options][transliterate]");
$element = $this
->xpath('//input[@name=:name]/@disabled', [
':name' => "third_party_settings[filefield_paths][file_{$field}][options][transliterate]",
]);
$this
->assertEmpty($element, 'Transliteration checkbox is not disabled in File ' . Unicode::ucfirst($field) . ' settings.');
}
}