'svg when not listed'=>[SVG,ExtensionSettingFiles::IMAGES,'Unsupported file type'],
'type outside the allow-list'=>[fn():string=>base64_decode(PNG,true),['image/jpeg'],'Unsupported file type'],
'truncated image'=>["\x89PNG\r\n\x1a\nnot really",ExtensionSettingFiles::IMAGES,'corrupt or unreadable'],
'svg with script'=>['<svg xmlns="http://www.w3.org/2000/svg"><script>alert(1)</script></svg>',['image/svg+xml'],'active or external content'],
'svg with handler'=>['<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"></svg>',['image/svg+xml'],'active or external content'],
'svg with script link'=>['<svg xmlns="http://www.w3.org/2000/svg"><a href="javascript:alert(1)"><rect/></a></svg>',['image/svg+xml'],'active or external content'],
'svg with doctype entity'=>['<?xml version="1.0"?><!DOCTYPE svg [<!ENTITY x SYSTEM "file:///etc/passwd">]><svg>&x;</svg>',['image/svg+xml'],'Unsupported file type'],
'prefixed script'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/2000/svg"><x:script>alert(1)</x:script></svg>','active or external content'],
'prefixed foreign object'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/2000/svg"><x:foreignObject>hi</x:foreignObject></svg>','active or external content'],
'prefixed animation'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/2000/svg"><rect><x:animate attributeName="fill" values="red"/></rect></svg>','active or external content'],
'prefixed set'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/2000/svg"><a><x:set attributeName="href" to="#x"/></a></svg>','active or external content'],
'xhtml script'=>['<svg xmlns="http://www.w3.org/2000/svg"><h:script xmlns:h="http://www.w3.org/1999/xhtml">alert(1)</h:script></svg>','outside the SVG namespace'],
'svg element without the svg namespace'=>['<svg><rect/></svg>','outside the SVG namespace'],
'prefixed handler attribute'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:e="urn:x"><rect e:onclick="alert(1)"/></svg>','outside the SVG namespace'],
'data link'=>['<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><use xlink:href="data:image/svg+xml;base64,PHN2Zy8+"/></svg>','active or external content'],
'script link split by whitespace'=>["<svg xmlns=\"http://www.w3.org/2000/svg\"><a href=\"java\tscript:alert(1)\"><rect/></a></svg>",'active or external content'],
'stylesheet processing instruction'=>['<?xml-stylesheet type="text/xsl" href="#x"?><svg xmlns="http://www.w3.org/2000/svg"/>','active or external content'],
]);
test('plain svg with links, xml attributes and embedded raster images is stored',function():void{
expect(fn()=>$files->store('probe',upload(base64_decode(PNG,true)),ExtensionSettingFiles::IMAGES,64))->toThrow(UnexpectedValueException::class,'must name a private disk');
expect(fn()=>$files->read('probe','0123456789abcdef0123456789abcdef01234567.png'))->toThrow(UnexpectedValueException::class,'must name a private disk');
test('the stock public disk is refused',function():void{
config(['extensions.files_disk'=>'public']);
expect(fn()=>(newExtensionSettingFiles)->store('probe',upload(base64_decode(PNG,true)),ExtensionSettingFiles::IMAGES,64))->toThrow(UnexpectedValueException::class,'must name a private disk');