WordPress.org

Make WordPress Core

Changeset 460 in tests


Ignore:
Timestamp:
10/20/2011 03:07:24 PM (7 years ago)
Author:
ryan
Message:

Describe all tables after blog creation to make sure they exist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_ms.php

    r459 r460  
    3232            $blog_id = wpmu_create_blog( $current_site->domain, 'path'.$i, "Title".$i, $id );
    3333            $this->assertInternalType( 'int', $blog_id );
     34
     35            $prefix = $wpdb->get_blog_prefix( $blog_id );
     36            foreach ( $wpdb->tables( 'blog', false ) as $table ) {
     37                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
     38                $this->assertNotEmpty( $table_fields );
     39            }
     40
    3441            $blog_ids[] = $blog_id;
    3542        }
     
    4451            // drop tables for every second blog
    4552            $drop_tables = ! $drop_tables;
    46             $blog_prefix = $wpdb->get_blog_prefix( $blog_id );
    4753            wpmu_delete_blog( $blog_id, $drop_tables );
    4854
    49             // test the $drop argument
    50             $blog_tables = $wpdb->get_results( "SHOW TABLES LIKE '{$blog_prefix}%'", ARRAY_A );
    51             if ( $drop_tables )
    52                 $this->assertEquals( 0 , count( $blog_tables ) );
    53             else
    54                 $this->assertGreaterThan( 0 , count( $blog_tables ) );
     55            $prefix = $wpdb->get_blog_prefix( $blog_id );
     56            foreach ( $wpdb->tables( 'blog', false ) as $table ) {
     57                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
     58                if ( $drop_tables )
     59                    $this->assertEmpty( $table_fields );
     60                else
     61                    $this->assertNotEmpty( $table_fields );
     62            }
    5563        }
    5664
Note: See TracChangeset for help on using the changeset viewer.