// Check the results of the configured sanitization.
$this->assertSame($expected_filename, $event->getFilename()); $this->assertSame($expected_filename !== $filename, $event->isSecurityRename());
// If the filename has been modified, let the user know.
if($event->isSecurityRename()){ $result->setSecurityRename(); }
// Set the permissions on the new file.
$this->fileSystem->chmod($file->getFileUri());
// We can now validate the file object itself before it's saved.
$violations = $file->validate(); foreach($violationsas$violation){ $errors[] = $violation->getMessage(); }