public function ArchiveValidatorTest::dataProviderValidate in Mini site 8
Data provider for testValidateFiles.
File
- tests/
src/ Unit/ ArchiveValidatorTest.php, line 36
Class
- ArchiveValidatorTest
- Class ArchiveValidatorTest.
Namespace
Drupal\Tests\minisite\UnitCode
public function dataProviderValidate() {
return [
[
[
'file.txt',
],
[
'ext',
],
'A single top level directory is expected.',
],
[
[
'file.txt',
'dir1/file.txt',
],
[
'ext',
],
'A single top level directory is expected.',
],
[
[
'dir1/',
'dir2/',
'dir1/file.txt',
],
[
'ext',
],
'A single top level directory is expected.',
],
[
[
'dir1/file.txt',
],
[
'ext',
],
sprintf('Missing required %s file.', AssetInterface::INDEX_FILE),
],
[
[
'dir1/',
'dir1/file.txt',
],
[
'ext',
],
sprintf('Missing required %s file.', AssetInterface::INDEX_FILE),
],
[
[
'dir1/' . AssetInterface::INDEX_FILE,
'dir1/file.txt',
],
[
'html',
'ext',
],
'Archive has invalid content: File dir1/file.txt has invalid extension.',
],
[
[
'dir1/' . AssetInterface::INDEX_FILE,
'dir1/file.txt',
'dir1/file2.txt',
],
[
'html',
'ext',
],
'Archive has invalid content: File dir1/file.txt has invalid extension.' . PHP_EOL . 'File dir1/file2.txt has invalid extension.',
],
[
[
'dir1/' . AssetInterface::INDEX_FILE,
'dir1/file.html',
'dir1/' . str_repeat('a', 2048) . '/file2.html',
],
[
'html',
],
'Archive has invalid content: File "dir1/' . str_repeat('a', 2048) . '/file2.html" path within the archive should be under 1986 characters in length.',
],
// Special case testing for allowed root-level directories.
// If the allowed root-level directory not correctly excluded - a
// different exception will be thrown.
[
[
'__MACOSX/',
'dir1/' . AssetInterface::INDEX_FILE,
'dir1/file.txt',
],
[
'html',
'ext',
],
'Archive has invalid content: File dir1/file.txt has invalid extension.',
],
];
}