Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / filerepo / FileRepoTest.php
blob43bceb7d3df3b35c796e4084c864bc8ba59be056
1 <?php
3 use MediaWiki\MainConfigNames;
4 use Wikimedia\FileBackend\FSFileBackend;
6 /**
7 * @covers \FileRepo
8 */
9 class FileRepoTest extends MediaWikiIntegrationTestCase {
11 public function testFileRepoConstructionOptionCanNotBeNull() {
12 $this->expectException( InvalidArgumentException::class );
13 new FileRepo();
16 public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
17 $this->expectException( InvalidArgumentException::class );
18 new FileRepo( [] );
21 public function testFileRepoConstructionOptionNeedNameKey() {
22 $this->expectException( InvalidArgumentException::class );
23 new FileRepo( [
24 'backend' => 'foobar'
25 ] );
28 public function testFileRepoConstructionOptionNeedBackendKey() {
29 $this->expectException( InvalidArgumentException::class );
30 new FileRepo( [
31 'name' => 'foobar'
32 ] );
35 public function testFileRepoConstructionWithRequiredOptions() {
36 $f = new FileRepo( [
37 'name' => 'FileRepoTestRepository',
38 'backend' => new FSFileBackend( [
39 'name' => 'local-testing',
40 'wikiId' => 'test_wiki',
41 'containerPaths' => []
42 ] )
43 ] );
44 $this->assertInstanceOf( FileRepo::class, $f );
47 public function testFileRepoConstructionWithInvalidCasing() {
48 $this->expectException( InvalidArgumentException::class );
49 $this->expectExceptionMessage( 'File repos with initial capital false' );
51 $this->overrideConfigValue( MainConfigNames::CapitalLinks, true );
53 new FileRepo( [
54 'name' => 'foobar',
55 'backend' => 'local-backend',
56 'initialCapital' => false,
57 ] );