Add sslCAFile option to DatabaseMysqli
[mediawiki.git] / tests / phpunit / includes / filebackend / SwiftFileBackendTest.php
blob9cd2b100cd989b3701590f7b8b989bd54d9a716d
1 <?php
3 use Wikimedia\TestingAccessWrapper;
5 /**
6 * @group FileRepo
7 * @group FileBackend
8 * @group medium
10 * @covers SwiftFileBackend
11 * @covers SwiftFileBackendDirList
12 * @covers SwiftFileBackendFileList
13 * @covers SwiftFileBackendList
15 class SwiftFileBackendTest extends MediaWikiTestCase {
16 /** @var TestingAccessWrapper Proxy to SwiftFileBackend */
17 private $backend;
19 protected function setUp() {
20 parent::setUp();
22 $this->backend = TestingAccessWrapper::newFromObject(
23 new SwiftFileBackend( [
24 'name' => 'local-swift-testing',
25 'class' => 'SwiftFileBackend',
26 'wikiId' => 'unit-testing',
27 'lockManager' => LockManagerGroup::singleton()->get( 'fsLockManager' ),
28 'swiftAuthUrl' => 'http://127.0.0.1:8080/auth', // unused
29 'swiftUser' => 'test:tester',
30 'swiftKey' => 'testing',
31 'swiftTempUrlKey' => 'b3968d0207b54ece87cccc06515a89d4' // unused
32 ] )
36 /**
37 * @dataProvider provider_testSanitizeHdrs
39 public function testSanitizeHdrs( $raw, $sanitized ) {
40 $hdrs = $this->backend->sanitizeHdrs( [ 'headers' => $raw ] );
42 $this->assertEquals( $hdrs, $sanitized, 'sanitizeHdrs() has expected result' );
45 public static function provider_testSanitizeHdrs() {
46 return [
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'
98 /**
99 * @dataProvider provider_testGetMetadataHeaders
101 public function testGetMetadataHeaders( $raw, $sanitized ) {
102 $hdrs = $this->backend->getMetadataHeaders( $raw );
104 $this->assertEquals( $hdrs, $sanitized, 'getMetadataHeaders() has expected result' );
107 public static function provider_testGetMetadataHeaders() {
108 return [
111 'content-length' => 345,
112 'content-custom' => 'hello',
113 'x-content-custom' => 'hello',
114 'x-object-meta-custom' => 5,
115 'x-object-meta-sha1Base36' => 'a3deadfg...',
118 'x-object-meta-custom' => 5,
119 'x-object-meta-sha1base36' => 'a3deadfg...',
126 * @dataProvider provider_testGetMetadata
128 public function testGetMetadata( $raw, $sanitized ) {
129 $hdrs = $this->backend->getMetadata( $raw );
131 $this->assertEquals( $hdrs, $sanitized, 'getMetadata() has expected result' );
134 public static function provider_testGetMetadata() {
135 return [
138 'content-length' => 345,
139 'content-custom' => 'hello',
140 'x-content-custom' => 'hello',
141 'x-object-meta-custom' => 5,
142 'x-object-meta-sha1Base36' => 'a3deadfg...',
145 'custom' => 5,
146 'sha1base36' => 'a3deadfg...',