17 'directory' =>
'/testdir',
20 'transformVia404' =>
false,
22 'name' =>
'local-backend',
25 'cont1' =>
"/testdir/local-backend/tempimages/cont1",
26 'cont2' =>
"/testdir/local-backend/tempimages/cont2"
30 $this->repo_hl0 =
new LocalRepo( [
'hashLevels' => 0 ] + $info );
31 $this->repo_hl2 =
new LocalRepo( [
'hashLevels' => 2 ] + $info );
32 $this->repo_lc =
new LocalRepo( [
'initialCapital' =>
false ] + $info );
33 $this->file_hl0 = $this->repo_hl0->newFile(
'test!' );
34 $this->file_hl2 = $this->repo_hl2->newFile(
'test!' );
35 $this->file_lc = $this->repo_lc->newFile(
'test!' );
42 $this->assertEquals(
'', $this->file_hl0->getHashPath() );
43 $this->assertEquals(
'a/a2/', $this->file_hl2->getHashPath() );
44 $this->assertEquals(
'c/c4/', $this->file_lc->getHashPath() );
51 $this->assertEquals(
'Test!', $this->file_hl0->getRel() );
52 $this->assertEquals(
'a/a2/Test!', $this->file_hl2->getRel() );
53 $this->assertEquals(
'c/c4/test!', $this->file_lc->getRel() );
60 $this->assertEquals(
'Test%21', $this->file_hl0->getUrlRel() );
61 $this->assertEquals(
'a/a2/Test%21', $this->file_hl2->getUrlRel() );
62 $this->assertEquals(
'c/c4/test%21', $this->file_lc->getUrlRel() );
70 'mwstore://local-backend/test-public/archive',
71 $this->file_hl0->getArchivePath()
74 'mwstore://local-backend/test-public/archive/a/a2',
75 $this->file_hl2->getArchivePath()
78 'mwstore://local-backend/test-public/archive/!',
79 $this->file_hl0->getArchivePath(
'!' )
82 'mwstore://local-backend/test-public/archive/a/a2/!',
83 $this->file_hl2->getArchivePath(
'!' )
92 'mwstore://local-backend/test-thumb/Test!',
93 $this->file_hl0->getThumbPath()
96 'mwstore://local-backend/test-thumb/a/a2/Test!',
97 $this->file_hl2->getThumbPath()
100 'mwstore://local-backend/test-thumb/Test!/x',
101 $this->file_hl0->getThumbPath(
'x' )
104 'mwstore://local-backend/test-thumb/a/a2/Test!/x',
105 $this->file_hl2->getThumbPath(
'x' )
113 $this->assertEquals(
'/testurl/archive', $this->file_hl0->getArchiveUrl() );
114 $this->assertEquals(
'/testurl/archive/a/a2', $this->file_hl2->getArchiveUrl() );
115 $this->assertEquals(
'/testurl/archive/%21', $this->file_hl0->getArchiveUrl(
'!' ) );
116 $this->assertEquals(
'/testurl/archive/a/a2/%21', $this->file_hl2->getArchiveUrl(
'!' ) );
123 $this->assertEquals(
'/testurl/thumb/Test%21', $this->file_hl0->getThumbUrl() );
124 $this->assertEquals(
'/testurl/thumb/a/a2/Test%21', $this->file_hl2->getThumbUrl() );
125 $this->assertEquals(
'/testurl/thumb/Test%21/x', $this->file_hl0->getThumbUrl(
'x' ) );
126 $this->assertEquals(
'/testurl/thumb/a/a2/Test%21/x', $this->file_hl2->getThumbUrl(
'x' ) );
133 $this->assertEquals(
'mwrepo://test/public/archive', $this->file_hl0->getArchiveVirtualUrl() );
135 'mwrepo://test/public/archive/a/a2',
136 $this->file_hl2->getArchiveVirtualUrl()
139 'mwrepo://test/public/archive/%21',
140 $this->file_hl0->getArchiveVirtualUrl(
'!' )
143 'mwrepo://test/public/archive/a/a2/%21',
144 $this->file_hl2->getArchiveVirtualUrl(
'!' )
152 $this->assertEquals(
'mwrepo://test/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() );
153 $this->assertEquals(
'mwrepo://test/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() );
155 'mwrepo://test/thumb/Test%21/%21',
156 $this->file_hl0->getThumbVirtualUrl(
'!' )
159 'mwrepo://test/thumb/a/a2/Test%21/%21',
160 $this->file_hl2->getThumbVirtualUrl(
'!' )
168 $this->assertEquals(
'/testurl/Test%21', $this->file_hl0->getUrl() );
169 $this->assertEquals(
'/testurl/a/a2/Test%21', $this->file_hl2->getUrl() );
176 $file =
wfLocalFile(
"File:Some_file_that_probably_doesn't exist.png" );
180 'wfLocalFile() returns LocalFile for valid Titles'