]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/phpunit/includes/filerepo/FileRepoTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / filerepo / FileRepoTest.php
diff --git a/tests/phpunit/includes/filerepo/FileRepoTest.php b/tests/phpunit/includes/filerepo/FileRepoTest.php
new file mode 100644 (file)
index 0000000..d1e6dc3
--- /dev/null
@@ -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( [] );
+       }
+
+       /**
+        * @expectedException MWException
+        * @covers FileRepo::__construct
+        */
+       public function testFileRepoConstructionOptionNeedNameKey() {
+               new FileRepo( [
+                       'backend' => 'foobar'
+               ] );
+       }
+
+       /**
+        * @expectedException MWException
+        * @covers FileRepo::__construct
+        */
+       public function testFileRepoConstructionOptionNeedBackendKey() {
+               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', $f );
+       }
+}