Merge "StringUtils: Add a utility for checking if a string is a valid regex"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiMainTest.php
index 580efcd..3a3f5f1 100644 (file)
@@ -141,7 +141,6 @@ class ApiMainTest extends ApiTestCase {
        public function testSetCacheModeUnrecognized() {
                $api = new ApiMain();
                $api->setCacheMode( 'unrecognized' );
-               $this->resetServices();
                $this->assertSame(
                        'private',
                        TestingAccessWrapper::newFromObject( $api )->mCacheMode,
@@ -243,11 +242,12 @@ class ApiMainTest extends ApiTestCase {
                $mock->method( 'needsToken' )->willReturn( true );
 
                $api = new ApiMain( new FauxRequest( [ 'action' => 'testmodule' ] ) );
-               $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
-                       function () use ( $mock ) {
+               $api->getModuleManager()->addModule( 'testmodule', 'action', [
+                       'class' => get_class( $mock ),
+                       'factory' => function () use ( $mock ) {
                                return $mock;
                        }
-               );
+               );
                $api->execute();
        }
 
@@ -261,11 +261,12 @@ class ApiMainTest extends ApiTestCase {
                $mock->method( 'mustBePosted' )->willReturn( false );
 
                $api = new ApiMain( new FauxRequest( [ 'action' => 'testmodule' ] ) );
-               $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
-                       function () use ( $mock ) {
+               $api->getModuleManager()->addModule( 'testmodule', 'action', [
+                       'class' => get_class( $mock ),
+                       'factory' => function () use ( $mock ) {
                                return $mock;
                        }
-               );
+               );
                $api->execute();
        }
 
@@ -310,11 +311,12 @@ class ApiMainTest extends ApiTestCase {
                $req->setRequestURL( "http://localhost" );
 
                $api = new ApiMain( $req );
-               $api->getModuleManager()->addModule( 'testmodule', 'action', get_class( $mock ),
-                       function () use ( $mock ) {
+               $api->getModuleManager()->addModule( 'testmodule', 'action', [
+                       'class' => get_class( $mock ),
+                       'factory' => function () use ( $mock ) {
                                return $mock;
                        }
-               );
+               );
 
                $wrapper = TestingAccessWrapper::newFromObject( $api );
                $wrapper->mInternalMode = false;