3use Wikimedia\TestingAccessWrapper;
22 $this->backend = TestingAccessWrapper::newFromObject(
24 'name' =>
'local-swift-testing',
25 'class' => SwiftFileBackend::class,
26 'wikiId' =>
'unit-testing',
28 'swiftAuthUrl' =>
'http://127.0.0.1:8080/auth',
29 'swiftUser' =>
'test:tester',
30 'swiftKey' =>
'testing',
31 'swiftTempUrlKey' =>
'b3968d0207b54ece87cccc06515a89d4'
40 $hdrs = $this->backend->sanitizeHdrsStrict( [
'headers' => $raw ] );
42 $this->assertEquals( $hdrs, $sanitized,
'sanitizeHdrsStrict() has expected result' );
49 'content-length' => 345,
50 'content-type' =>
'image+bitmap/jpeg',
51 'content-disposition' =>
'inline',
52 'content-duration' => 35.6363,
53 'content-Custom' =>
'hello',
54 'x-content-custom' =>
'hello'
57 'content-disposition' =>
'inline',
58 'content-duration' => 35.6363,
59 'content-custom' =>
'hello',
60 'x-content-custom' =>
'hello'
65 'content-length' => 345,
66 'content-type' =>
'image+bitmap/jpeg',
67 'content-Disposition' =>
'inline; filename=xxx; ' . str_repeat(
'o', 1024 ),
68 'content-duration' => 35.6363,
69 'content-custom' =>
'hello',
70 'x-content-custom' =>
'hello'
73 'content-disposition' =>
'inline;filename=xxx',
74 'content-duration' => 35.6363,
75 'content-custom' =>
'hello',
76 'x-content-custom' =>
'hello'
81 'content-length' => 345,
82 'content-type' =>
'image+bitmap/jpeg',
83 'content-disposition' =>
'filename=' . str_repeat(
'o', 1024 ) .
';inline',
84 'content-duration' => 35.6363,
85 'content-custom' =>
'hello',
86 'x-content-custom' =>
'hello'
89 'content-disposition' =>
'',
90 'content-duration' => 35.6363,
91 'content-custom' =>
'hello',
92 'x-content-custom' =>
'hello'
102 $hdrs = $this->backend->sanitizeHdrs( [
'headers' => $raw ] );
104 $this->assertEquals( $hdrs, $sanitized,
'sanitizeHdrs() has expected result' );
111 'content-length' => 345,
112 'content-type' =>
'image+bitmap/jpeg',
113 'content-disposition' =>
'inline',
114 'content-duration' => 35.6363,
115 'content-Custom' =>
'hello',
116 'x-content-custom' =>
'hello'
119 'content-type' =>
'image+bitmap/jpeg',
120 'content-disposition' =>
'inline',
121 'content-duration' => 35.6363,
122 'content-custom' =>
'hello',
123 'x-content-custom' =>
'hello'
128 'content-length' => 345,
129 'content-type' =>
'image+bitmap/jpeg',
130 'content-Disposition' =>
'inline; filename=xxx; ' . str_repeat(
'o', 1024 ),
131 'content-duration' => 35.6363,
132 'content-custom' =>
'hello',
133 'x-content-custom' =>
'hello'
136 'content-type' =>
'image+bitmap/jpeg',
137 'content-disposition' =>
'inline;filename=xxx',
138 'content-duration' => 35.6363,
139 'content-custom' =>
'hello',
140 'x-content-custom' =>
'hello'
145 'content-length' => 345,
146 'content-type' =>
'image+bitmap/jpeg',
147 'content-disposition' =>
'filename=' . str_repeat(
'o', 1024 ) .
';inline',
148 'content-duration' => 35.6363,
149 'content-custom' =>
'hello',
150 'x-content-custom' =>
'hello'
153 'content-type' =>
'image+bitmap/jpeg',
154 'content-disposition' =>
'',
155 'content-duration' => 35.6363,
156 'content-custom' =>
'hello',
157 'x-content-custom' =>
'hello'
167 $hdrs = $this->backend->getMetadataHeaders( $raw );
169 $this->assertEquals( $hdrs, $sanitized,
'getMetadataHeaders() has expected result' );
176 'content-length' => 345,
177 'content-custom' =>
'hello',
178 'x-content-custom' =>
'hello',
179 'x-object-meta-custom' => 5,
180 'x-object-meta-sha1Base36' =>
'a3deadfg...',
183 'x-object-meta-custom' => 5,
184 'x-object-meta-sha1base36' =>
'a3deadfg...',
194 $hdrs = $this->backend->getMetadata( $raw );
196 $this->assertEquals( $hdrs, $sanitized,
'getMetadata() has expected result' );
203 'content-length' => 345,
204 'content-custom' =>
'hello',
205 'x-content-custom' =>
'hello',
206 'x-object-meta-custom' => 5,
207 'x-object-meta-sha1Base36' =>
'a3deadfg...',
211 'sha1base36' =>
'a3deadfg...',
static singleton( $domain=false)
FileRepo FileBackend medium.
static provider_testGetMetadata()
testSanitizeHdrsStrict( $raw, $sanitized)
provider_testSanitizeHdrsStrict
testGetMetadataHeaders( $raw, $sanitized)
provider_testGetMetadataHeaders
TestingAccessWrapper $backend
Proxy to SwiftFileBackend.
testSanitizeHdrs( $raw, $sanitized)
provider_testSanitizeHdrs
testGetMetadata( $raw, $sanitized)
provider_testGetMetadata
static provider_testSanitizeHdrs()
static provider_testGetMetadataHeaders()
static provider_testSanitizeHdrsStrict()
Class for an OpenStack Swift (or Ceph RGW) based file backend.