8 class SwiftFileBackendTest
extends MediaWikiTestCase
{
9 /** @var SwiftFileBackend */
12 protected function setUp() {
15 $this->backend
= TestingAccessWrapper
::newFromObject(
16 new SwiftFileBackend( array(
17 'name' => 'local-swift-testing',
18 'class' => 'SwiftFileBackend',
19 'wikiId' => 'unit-testing',
20 'lockManager' => LockManagerGroup
::singleton()->get( 'fsLockManager' ),
21 'swiftAuthUrl' => 'http://127.0.0.1:8080/auth', // unused
22 'swiftUser' => 'test:tester',
23 'swiftKey' => 'testing',
24 'swiftTempUrlKey' => 'b3968d0207b54ece87cccc06515a89d4' // unused
30 * @dataProvider provider_testSanitzeHdrs
31 * @covers SwiftFileBackend::sanitzeHdrs
33 public function testSanitzeHdrs( $raw, $sanitized ) {
34 $hdrs = $this->backend
->sanitizeHdrs( array( 'headers' => $raw ) );
36 $this->assertEquals( $hdrs, $sanitized, 'sanitizeHdrs() has expected result' );
39 public static function provider_testSanitzeHdrs() {
43 'content-length' => 345,
44 'content-type' => 'image+bitmap/jpeg',
45 'content-disposition' => 'inline',
46 'content-duration' => 35.6363,
47 'content-custom' => 'hello',
48 'x-content-custom' => 'hello'
51 'content-disposition' => 'inline',
52 'content-duration' => 35.6363,
53 'content-custom' => 'hello',
54 'x-content-custom' => 'hello'
59 'content-length' => 345,
60 'content-type' => 'image+bitmap/jpeg',
61 'content-disposition' => 'inline; filename=xxx; ' . str_repeat( 'o', 1024 ),
62 'content-duration' => 35.6363,
63 'content-custom' => 'hello',
64 'x-content-custom' => 'hello'
67 'content-disposition' => 'inline;filename=xxx',
68 'content-duration' => 35.6363,
69 'content-custom' => 'hello',
70 'x-content-custom' => 'hello'
75 'content-length' => 345,
76 'content-type' => 'image+bitmap/jpeg',
77 'content-disposition' => 'filename='. str_repeat( 'o', 1024 ) . ';inline',
78 'content-duration' => 35.6363,
79 'content-custom' => 'hello',
80 'x-content-custom' => 'hello'
83 'content-disposition' => '',
84 'content-duration' => 35.6363,
85 'content-custom' => 'hello',
86 'x-content-custom' => 'hello'