diff options
Diffstat (limited to 'tests/phpunit/includes/filerepo/FileRepoTest.php')
-rw-r--r-- | tests/phpunit/includes/filerepo/FileRepoTest.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/phpunit/includes/filerepo/FileRepoTest.php b/tests/phpunit/includes/filerepo/FileRepoTest.php new file mode 100644 index 00000000..a196dca8 --- /dev/null +++ b/tests/phpunit/includes/filerepo/FileRepoTest.php @@ -0,0 +1,55 @@ +<?php + +class FileRepoTest extends MediaWikiTestCase { + + /** + * @expectedException MWException + * @covers FileRepo::__construct + */ + public function testFileRepoConstructionOptionCanNotBeNull() { + new FileRepo(); + } + + /** + * @expectedException MWException + * @covers FileRepo::__construct + */ + public function testFileRepoConstructionOptionCanNotBeAnEmptyArray() { + new FileRepo( array() ); + } + + /** + * @expectedException MWException + * @covers FileRepo::__construct + */ + public function testFileRepoConstructionOptionNeedNameKey() { + new FileRepo( array( + 'backend' => 'foobar' + ) ); + } + + /** + * @expectedException MWException + * @covers FileRepo::__construct + */ + public function testFileRepoConstructionOptionNeedBackendKey() { + new FileRepo( array( + 'name' => 'foobar' + ) ); + } + + /** + * @covers FileRepo::__construct + */ + public function testFileRepoConstructionWithRequiredOptions() { + $f = new FileRepo( array( + 'name' => 'FileRepoTestRepository', + 'backend' => new FSFileBackend( array( + 'name' => 'local-testing', + 'wikiId' => 'test_wiki', + 'containerPaths' => array() + ) ) + ) ); + $this->assertInstanceOf( 'FileRepo', $f ); + } +} |