Build/Test Tools: Document PHP unit test classes.
Props boonebgorges. Fixes #35494. git-svn-id: https://develop.svn.wordpress.org/trunk@36854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
48959ec76e
commit
59c8ba7871
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract class that serves as a basis for all WordPress object-type factory classes.
|
||||||
|
*/
|
||||||
abstract class WP_UnitTest_Factory_For_Thing {
|
abstract class WP_UnitTest_Factory_For_Thing {
|
||||||
|
|
||||||
var $default_generation_definitions;
|
var $default_generation_definitions;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factory for making WordPress data with a cross-object type API.
|
||||||
|
*
|
||||||
|
* Tests should use this factory to generate test fixtures.
|
||||||
|
*/
|
||||||
class WP_UnitTest_Factory {
|
class WP_UnitTest_Factory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,15 @@
|
|||||||
require_once dirname( __FILE__ ) . '/factory.php';
|
require_once dirname( __FILE__ ) . '/factory.php';
|
||||||
require_once dirname( __FILE__ ) . '/trac.php';
|
require_once dirname( __FILE__ ) . '/trac.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a basic fixture to run multiple tests.
|
||||||
|
*
|
||||||
|
* Resets the state of the WordPress installation before and after every test.
|
||||||
|
*
|
||||||
|
* Includes utility functions and assertions useful for testing WordPress.
|
||||||
|
*
|
||||||
|
* All WordPress unit tests should inherit from this class.
|
||||||
|
*/
|
||||||
class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
protected static $forced_tickets = array();
|
protected static $forced_tickets = array();
|
||||||
@ -124,6 +133,9 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
|||||||
$this->expectedDeprecated();
|
$this->expectedDeprecated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After a test method runs, reset any state in WordPress the test method might have changed.
|
||||||
|
*/
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
global $wpdb, $wp_query, $wp, $post;
|
global $wpdb, $wp_query, $wp, $post;
|
||||||
$wpdb->query( 'ROLLBACK' );
|
$wpdb->query( 'ROLLBACK' );
|
||||||
|
Loading…
Reference in New Issue
Block a user