Make WordPress Core

Ticket #35494: 35494.diff

File 35494.diff, 1.6 KB (added by ericlewis, 9 years ago)
  • tests/phpunit/includes/factory.php

     
    11<?php
    22
     3/**
     4 * A factory for making WordPress data with a cross-object type API.
     5 *
     6 * Tests should use these functions to create test data.
     7 */
    38class WP_UnitTest_Factory {
    49
    510        /**
     
    296301        }
    297302}
    298303
     304/**
     305 * An abstract class that serves as a basis for all WordPress object-type
     306 * factory classes.
     307 */
    299308abstract class WP_UnitTest_Factory_For_Thing {
    300309
    301310        var $default_generation_definitions;
  • tests/phpunit/includes/testcase.php

     
    33require_once dirname( __FILE__ ) . '/factory.php';
    44require_once dirname( __FILE__ ) . '/trac.php';
    55
     6/**
     7 * Defines a basic fixture to run multiple tests.
     8 *
     9 * Resets the state of the WordPress installation before and after every test.
     10 *
     11 * Includes utility functions and assertions useful for testing WordPress.
     12 *
     13 * All WordPress unit tests should inherit from this class.
     14 */
    615class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
    716
    817        protected static $forced_tickets = array();
     
    123132                $this->expectedDeprecated();
    124133        }
    125134
     135        /**
     136         * After a test method runs, reset any state in WordPress
     137         * the test method might have changed.
     138         */
    126139        function tearDown() {
    127140                global $wpdb, $wp_query, $wp, $post;
    128141                $wpdb->query( 'ROLLBACK' );