WordPress.org

Make WordPress Core

Changeset 361 in tests


Ignore:
Timestamp:
06/02/2011 11:30:46 AM (7 years ago)
Author:
dd32
Message:

Add a new TestData set based off the latest Theme Test Data files.

Location:
wp-testdata
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testdata/sample_blogs.php

    r325 r361  
    8484}
    8585
     86// a faster way to get the Theme Test Data(test-data.2011-01-17.xml) dataset than using the importer
     87class _WPDataset2 extends _WPEmptyBlog {
     88    function setUp() {
     89        parent::setUp();
     90        $this->_nuke_main_tables();
     91        $this->_load_sql_dump(DIR_TESTDATA . '/export/test-data.2011-01-17.sql');
     92    }
     93   
     94    function tearDown() {
     95        $this->_nuke_main_tables();
     96        parent::tearDown();
     97    }
     98   
     99    function _nuke_main_tables() {
     100        global $wpdb;
     101        // crude but effective: make sure there's no residual data in the main tables
     102        foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
     103            $wpdb->query("DELETE FROM {$wpdb->$table}");
     104    }
     105}
     106
    86107?>
Note: See TracChangeset for help on using the changeset viewer.