]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - tests/phpunit/includes/filerepo/FileRepoTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / filerepo / FileRepoTest.php
1 <?php
2
3 class FileRepoTest extends MediaWikiTestCase {
4
5         /**
6          * @expectedException MWException
7          * @covers FileRepo::__construct
8          */
9         public function testFileRepoConstructionOptionCanNotBeNull() {
10                 new FileRepo();
11         }
12
13         /**
14          * @expectedException MWException
15          * @covers FileRepo::__construct
16          */
17         public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() {
18                 new FileRepo( [] );
19         }
20
21         /**
22          * @expectedException MWException
23          * @covers FileRepo::__construct
24          */
25         public function testFileRepoConstructionOptionNeedNameKey() {
26                 new FileRepo( [
27                         'backend' => 'foobar'
28                 ] );
29         }
30
31         /**
32          * @expectedException MWException
33          * @covers FileRepo::__construct
34          */
35         public function testFileRepoConstructionOptionNeedBackendKey() {
36                 new FileRepo( [
37                         'name' => 'foobar'
38                 ] );
39         }
40
41         /**
42          * @covers FileRepo::__construct
43          */
44         public function testFileRepoConstructionWithRequiredOptions() {
45                 $f = new FileRepo( [
46                         'name' => 'FileRepoTestRepository',
47                         'backend' => new FSFileBackend( [
48                                 'name' => 'local-testing',
49                                 'wikiId' => 'test_wiki',
50                                 'containerPaths' => []
51                         ] )
52                 ] );
53                 $this->assertInstanceOf( 'FileRepo', $f );
54         }
55 }