config: Complete coverage for Config class
authorTimo Tijhof <krinklemail@gmail.com>
Sun, 23 Jul 2017 00:33:16 +0000 (17:33 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Sun, 23 Jul 2017 00:37:52 +0000 (17:37 -0700)
* Fix @covers for testSalvage and testGetConfigNames.
* Add missing coverage for registering an object directly.

Change-Id: Ib42b8333a1716d2a4747c25ab3f6cd795e546f3e

tests/phpunit/includes/config/ConfigFactoryTest.php

index ba38128..608d8d9 100644 (file)
@@ -47,7 +47,7 @@ class ConfigFactoryTest extends MediaWikiTestCase {
        }
 
        /**
-        * @covers ConfigFactory::register
+        * @covers ConfigFactory::salvage
         */
        public function testSalvage() {
                $oldFactory = new ConfigFactory();
@@ -83,7 +83,7 @@ class ConfigFactoryTest extends MediaWikiTestCase {
        }
 
        /**
-        * @covers ConfigFactory::register
+        * @covers ConfigFactory::getConfigNames
         */
        public function testGetConfigNames() {
                $factory = new ConfigFactory();
@@ -96,7 +96,7 @@ class ConfigFactoryTest extends MediaWikiTestCase {
        /**
         * @covers ConfigFactory::makeConfig
         */
-       public function testMakeConfig() {
+       public function testMakeConfigWithCallback() {
                $factory = new ConfigFactory();
                $factory->register( 'unittest', 'GlobalVarConfig::newInstance' );
 
@@ -105,6 +105,16 @@ class ConfigFactoryTest extends MediaWikiTestCase {
                $this->assertSame( $conf, $factory->makeConfig( 'unittest' ) );
        }
 
+       /**
+        * @covers ConfigFactory::makeConfig
+        */
+       public function testMakeConfigWithObject() {
+               $factory = new ConfigFactory();
+               $conf = new HashConfig();
+               $factory->register( 'test', $conf );
+               $this->assertSame( $conf, $factory->makeConfig( 'test' ) );
+       }
+
        /**
         * @covers ConfigFactory::makeConfig
         */