* @group Database */ class OATHAuthModuleRegistryTest extends MediaWikiIntegrationTestCase { /** @var string[] */ protected $tablesUsed = [ 'oathauth_types' ]; /** * @covers \MediaWiki\Extension\OATHAuth\OATHAuthModuleRegistry::getModuleIds */ public function testGetModuleIds() { $this->db->newInsertQueryBuilder() ->insertInto( 'oathauth_types' ) ->row( [ 'oat_name' => 'first' ] ) ->caller( __METHOD__ ) ->execute(); $database = $this->createMock( IConnectionProvider::class ); $database->method( 'getPrimaryDatabase' )->with( 'virtual-oathauth' )->willReturn( $this->db ); $database->method( 'getReplicaDatabase' )->with( 'virtual-oathauth' )->willReturn( $this->db ); $registry = new OATHAuthModuleRegistry( $database, [ 'first' => 'does not matter', 'second' => 'does not matter', 'third' => 'does not matter', ] ); $this->assertEquals( [ 'first', 'second', 'third' ], array_keys( $registry->getModuleIds() ) ); } }