public function testDoCheckOnAfterCreate()
 {
     $connection = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('query'))->getMockForAbstractClass();
     $connection->expects($this->any())->method('getType')->will($this->returnValue('postgres'));
     $connection->expects($this->at(3))->method('query')->with($this->stringContains('ALTER SEQUENCE'));
     $instance = PostgresTableBuilder::factory($connection);
     $instance->checkOn($instance::POST_CREATION);
 }
 /**
  * @since 2.5
  *
  * @param DatabaseBase $connection
  *
  * @return TableBuilder
  * @throws RuntimeException
  */
 public static function factory(DatabaseBase $connection)
 {
     $instance = null;
     switch ($connection->getType()) {
         case 'mysql':
             $instance = new MySQLTableBuilder($connection);
             break;
         case 'sqlite':
             $instance = new SQLiteTableBuilder($connection);
             break;
         case 'postgres':
             $instance = new PostgresTableBuilder($connection);
             break;
     }
     if ($instance === null) {
         throw new RuntimeException("Unknown DB type " . $connection->getType());
     }
     $instance->setDbName($GLOBALS['wgDBname']);
     $instance->setTableOptions($GLOBALS['wgDBTableOptions']);
     return $instance;
 }