X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Ffilebackend%2FSwiftFileBackendTest.php;h=b57af25a494a4c7dba5abf8dd587975066dfb72d;hb=cf0ebed65ad14dc9a48b0d69e0d77fc5f4f83e92;hp=6acc94388a1bae23279353b45122802b5ccff216;hpb=f3690d48bc666825c6452911d901549a9c14a37c;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php index 6acc94388a..b57af25a49 100644 --- a/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php +++ b/tests/phpunit/includes/filebackend/SwiftFileBackendTest.php @@ -1,5 +1,7 @@ backend->sanitizeHdrsStrict( [ 'headers' => $raw ] ); + + $this->assertEquals( $hdrs, $sanitized, 'sanitizeHdrsStrict() has expected result' ); + } + + public static function provider_testSanitizeHdrsStrict() { + return [ + [ + [ + 'content-length' => 345, + 'content-type' => 'image+bitmap/jpeg', + 'content-disposition' => 'inline', + 'content-duration' => 35.6363, + 'content-Custom' => 'hello', + 'x-content-custom' => 'hello' + ], + [ + 'content-disposition' => 'inline', + 'content-duration' => 35.6363, + 'content-custom' => 'hello', + 'x-content-custom' => 'hello' + ] + ], + [ + [ + 'content-length' => 345, + 'content-type' => 'image+bitmap/jpeg', + 'content-Disposition' => 'inline; filename=xxx; ' . str_repeat( 'o', 1024 ), + 'content-duration' => 35.6363, + 'content-custom' => 'hello', + 'x-content-custom' => 'hello' + ], + [ + 'content-disposition' => 'inline;filename=xxx', + 'content-duration' => 35.6363, + 'content-custom' => 'hello', + 'x-content-custom' => 'hello' + ] + ], + [ + [ + 'content-length' => 345, + 'content-type' => 'image+bitmap/jpeg', + 'content-disposition' => 'filename=' . str_repeat( 'o', 1024 ) . ';inline', + 'content-duration' => 35.6363, + 'content-custom' => 'hello', + 'x-content-custom' => 'hello' + ], + [ + 'content-disposition' => '', + 'content-duration' => 35.6363, + 'content-custom' => 'hello', + 'x-content-custom' => 'hello' + ] + ] + ]; + } + /** * @dataProvider provider_testSanitizeHdrs */ @@ -52,6 +116,7 @@ class SwiftFileBackendTest extends MediaWikiTestCase { 'x-content-custom' => 'hello' ], [ + 'content-type' => 'image+bitmap/jpeg', 'content-disposition' => 'inline', 'content-duration' => 35.6363, 'content-custom' => 'hello', @@ -68,6 +133,7 @@ class SwiftFileBackendTest extends MediaWikiTestCase { 'x-content-custom' => 'hello' ], [ + 'content-type' => 'image+bitmap/jpeg', 'content-disposition' => 'inline;filename=xxx', 'content-duration' => 35.6363, 'content-custom' => 'hello', @@ -84,6 +150,7 @@ class SwiftFileBackendTest extends MediaWikiTestCase { 'x-content-custom' => 'hello' ], [ + 'content-type' => 'image+bitmap/jpeg', 'content-disposition' => '', 'content-duration' => 35.6363, 'content-custom' => 'hello',