blob: 71e5125f3516c0abc5e85a4d320ec664783bdf06 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
use MediaWiki\MainConfigNames;
class FileRepoTest extends MediaWikiIntegrationTestCase {
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeNull() {
$this->expectException( MWException::class );
new FileRepo();
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
$this->expectException( MWException::class );
new FileRepo( [] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedNameKey() {
$this->expectException( MWException::class );
new FileRepo( [
'backend' => 'foobar'
] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionOptionNeedBackendKey() {
$this->expectException( MWException::class );
new FileRepo( [
'name' => 'foobar'
] );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionWithRequiredOptions() {
$f = new FileRepo( [
'name' => 'FileRepoTestRepository',
'backend' => new FSFileBackend( [
'name' => 'local-testing',
'wikiId' => 'test_wiki',
'containerPaths' => []
] )
] );
$this->assertInstanceOf( FileRepo::class, $f );
}
/**
* @covers FileRepo::__construct
*/
public function testFileRepoConstructionWithInvalidCasing() {
$this->expectException( InvalidArgumentException::class );
$this->expectExceptionMessage( 'File repos with initial capital false' );
$this->overrideConfigValue( MainConfigNames::CapitalLinks, true );
new FileRepo( [
'name' => 'foobar',
'backend' => 'local-backend',
'initialCapital' => false,
] );
}
}
|