/**
* This will ensure the filename length is valid.
*/ publicfunctiontestFileValidateNameLength(){ // Create a new file entity.
$file = File::create();
functiondrupal_phpunit_find_extension_directories($scan_directory){ $extensions = []; $dirs = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($scan_directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS)); foreach($dirsas$dir){ if(str_contains($dir->getPathname(), '.info.yml')){ // Cut off ".info.yml" from the filename for use as the extension name. We
// use getRealPath() so that we can scan extensions represented by
// directory aliases.
$extensions[substr($dir->getFilename(), 0, -9)] = $dir->getPathInfo() ->getRealPath(); } } return$extensions; }
/**
* Returns directories under which contributed extensions may exist.
*
* @param string $root
* (optional) Path to the root of the Drupal installation.
*
* @return array
* An array of directories under which contributed extensions may exist.
*/
// Create a new node with the uploaded file.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
// Load the node and the file.
$node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $file = File::load($node->{$field_name}->target_id);
/**
* Helper function which checks if the passed template
* or the inheritance templates has configuration sets.
*/ privatefunctionhasTemplateConfigSet(Template $template): bool { $theme = $this->get(Util::class)->getThemeByTemplate($template);