Make WordPress Core

Changeset 420 in tests for wp-test.php


Ignore:
Timestamp:
08/22/2011 10:51:44 PM (15 years ago)
Author:
ryan
Message:

First hacky stab at MS support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-test.php

    r407 r420  
    2727        define('DIR_TESTDATA', './wp-testdata');
    2828define('TEST_WP', true);
    29 define('TEST_MU', (@$opts['v'] == 'mu'));
     29define('TEST_MS', (@$opts['v'] == 'ms'));
    3030define('TEST_SKIP_KNOWN_BUGS', array_key_exists('s', $opts));
    3131define('TEST_FORCE_KNOWN_BUGS', array_key_exists('f', $opts));
     
    4949
    5050// configure wp
     51
     52if ( TEST_MS ) {
     53        define( 'MULTISITE', true );
     54        define( 'SUBDOMAIN_INSTALL', false );
     55        define( 'DOMAIN_CURRENT_SITE', 'localhost' );
     56        define( 'PATH_CURRENT_SITE', '/' );
     57        define( 'SITE_ID_CURRENT_SITE', 1 );
     58        define( 'BLOG_ID_CURRENT_SITE', 1 );
     59}
    5160
    5261require_once(DIR_TESTROOT.'/wp-config.php');
     
    7786drop_tables();
    7887
    79 if (TEST_MU)
    80         require_once(ABSPATH.'wp-admin/upgrade-functions.php');
    81 else
    82         require_once(ABSPATH.'wp-admin/includes/upgrade.php');
     88require_once(ABSPATH.'wp-admin/includes/upgrade.php');
    8389wp_install(WP_BLOG_TITLE, WP_USER_NAME, WP_USER_EMAIL, true);
    8490
    85 if (TEST_MU) {
    86                 // wp-settings.php would normally init this stuff, but that doesn't work because we've
    87                 // only just installed
    88                 $GLOBALS['blog_id'] = 1;
    89                 $GLOBALS['wpdb']->blogid = 1;
    90                 $GLOBALS['current_blog'] = $GLOBALS['wpdb']->get_results('SELECT * from wp_blogs where blog_id=1');
     91if ( TEST_MS ) {
     92        install_network();
     93        $base = get_option( 'siteurl' );
     94        populate_network( 1, 'localhost', 'null@localhost', 'Test Site', $base, false );
     95
     96        // wp-settings.php would normally init this stuff, but that doesn't work because we've
     97        // only just installed
     98        $GLOBALS['blog_id'] = 1;
     99        $GLOBALS['wpdb']->blogid = 1;
     100        $GLOBALS['current_blog'] = $GLOBALS['wpdb']->get_results('SELECT * from wp_blogs where blog_id=1');
    91101}
    92102
Note: See TracChangeset for help on using the changeset viewer.