PHP Class WP_UnitTestCase

Inheritance: extends PHPUnit_Framework_TestCase
Afficher le fichier Open project: lucatume/wp-browser Class Usage Examples

Protected Properties

Свойство Type Description
$caught_deprecated
$caught_doing_it_wrong
$expected_deprecated
$expected_doing_it_wrong
$forced_tickets
$hooks_saved
$ignore_files

Méthodes publiques

Méthode Description
__get ( $name )
__isset ( $name )
_create_temporary_tables ( $query )
_drop_temporary_tables ( $query )
_make_attachment ( $upload, $parent_post_id )
assertDiscardWhitespace ( $expected, $actual )
assertEqualFields ( $object, $fields )
assertEqualSets ( $expected, $actual )
assertEqualSetsWithIndex ( $expected, $actual )
assertNotWPError ( $actual, $message = '' )
assertQueryTrue ( ) Check each of the WP_Query is_* functions/properties against expected boolean value.
assertWPError ( $actual, $message = '' )
clean_up_global_scope ( )
commit_transaction ( ) Commit the queries in a transaction.
delete_folders ( $path )
delete_user ( $user_id ) Multisite-agnostic way to delete a user from the database.
deprecated_function_run ( $function )
doing_it_wrong_run ( $function )
expectDeprecated ( )
expectedDeprecated ( )
files_in_dir ( $dir )
flush_cache ( )
forceTicket ( $ticket )
get_called_class ( )
get_wp_die_handler ( $handler )
go_to ( string $url ) Modify WordPress's query internals as if a given URL has been requested.
knownPluginBug ( $ticket_id ) Skips the current test if there is an open plugin ticket with id $ticket_id
knownUTBug ( $ticket_id ) Skips the current test if there is an open unit tests ticket with id $ticket_id
knownWPBug ( $ticket_id ) Skips the current test if there is an open WordPress ticket with id $ticket_id
prepareTemplate ( Text_Template $template ) Define constants after including files.
remove_added_uploads ( )
rmdir ( $path )
scan_user_uploads ( )
scandir ( $dir )
setExpectedDeprecated ( string $deprecated ) Declare an expected _deprecated_function() or _deprecated_argument() call from within a test.
setExpectedIncorrectUsage ( $doing_it_wrong ) Declare an expected _doing_it_wrong() call from within a test.
setUp ( )
setUpBeforeClass ( )
set_permalink_structure ( string $structure = '' ) Utility method that resets permalinks and flushes rewrites.
start_transaction ( )
tearDown ( ) After a test method runs, reset any state in WordPress the test method might have changed.
tearDownAfterClass ( )
temp_filename ( ) Returns the name of a temporary file
unlink ( $file )
wp_die_handler ( $message )

Méthodes protégées

Méthode Description
_backup_hooks ( ) : void Saves the action and filter-related globals so they can be restored later.
_microtime_to_float ( $microtime ) Helper to Convert a microtime string into a float
_restore_hooks ( ) : void Restores the hook-related globals to their state at setUp() so that future tests aren't affected by hooks set during this last test.
assertPostConditions ( ) Detect post-test failure conditions.
checkRequirements ( )
factory ( )
reset__SERVER ( ) Reset $_SERVER variables
reset_post_statuses ( ) Unregister non-built-in post statuses.
reset_post_types ( ) Unregister existing post types and register defaults.
reset_taxonomies ( ) Unregister existing taxonomies and register defaults.

Method Details

__get() public méthode

public __get ( $name )

__isset() public méthode

public __isset ( $name )

_backup_hooks() protected méthode

Stores $merged_filters, $wp_actions, $wp_current_filter, and $wp_filter on a class variable so they can be restored on tearDown() using _restore_hooks().
protected _backup_hooks ( ) : void
Résultat void

_create_temporary_tables() public méthode

public _create_temporary_tables ( $query )

_drop_temporary_tables() public méthode

public _drop_temporary_tables ( $query )

_make_attachment() public méthode

public _make_attachment ( $upload, $parent_post_id )

_microtime_to_float() protected méthode

Helper to Convert a microtime string into a float
protected _microtime_to_float ( $microtime )

_restore_hooks() protected méthode

Restores the hook-related globals to their state at setUp() so that future tests aren't affected by hooks set during this last test.
protected _restore_hooks ( ) : void
Résultat void

assertDiscardWhitespace() public méthode

public assertDiscardWhitespace ( $expected, $actual )

assertEqualFields() public méthode

public assertEqualFields ( $object, $fields )

assertEqualSets() public méthode

public assertEqualSets ( $expected, $actual )

assertEqualSetsWithIndex() public méthode

public assertEqualSetsWithIndex ( $expected, $actual )

assertNotWPError() public méthode

public assertNotWPError ( $actual, $message = '' )

assertPostConditions() protected méthode

We use this method to detect expectedDeprecated and expectedIncorrectUsage annotations.
Since: 4.2.0
protected assertPostConditions ( )

assertQueryTrue() public méthode

Any properties that are listed by name as parameters will be expected to be true; any others are expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single() and is_feed() must be true and everything else must be false to pass.
public assertQueryTrue ( )

assertWPError() public méthode

public assertWPError ( $actual, $message = '' )

checkRequirements() protected méthode

protected checkRequirements ( )

clean_up_global_scope() public méthode

commit_transaction() public static méthode

Commit the queries in a transaction.
Since: 4.1.0
public static commit_transaction ( )

delete_folders() public méthode

public delete_folders ( $path )

delete_user() public static méthode

Multisite-agnostic way to delete a user from the database.
Since: 4.3.0
public static delete_user ( $user_id )

deprecated_function_run() public méthode

public deprecated_function_run ( $function )

doing_it_wrong_run() public méthode

public doing_it_wrong_run ( $function )

expectDeprecated() public méthode

public expectDeprecated ( )

expectedDeprecated() public méthode

public expectedDeprecated ( )

factory() protected static méthode

protected static factory ( )

files_in_dir() public méthode

public files_in_dir ( $dir )

flush_cache() public méthode

public flush_cache ( )

forceTicket() public static méthode

public static forceTicket ( $ticket )

get_called_class() public static méthode

public static get_called_class ( )

get_wp_die_handler() public méthode

public get_wp_die_handler ( $handler )

go_to() public méthode

Modify WordPress's query internals as if a given URL has been requested.
public go_to ( string $url )
$url string The URL for the request.

knownPluginBug() public méthode

Skips the current test if there is an open plugin ticket with id $ticket_id
public knownPluginBug ( $ticket_id )

knownUTBug() public méthode

Skips the current test if there is an open unit tests ticket with id $ticket_id
public knownUTBug ( $ticket_id )

knownWPBug() public méthode

Skips the current test if there is an open WordPress ticket with id $ticket_id
public knownWPBug ( $ticket_id )

prepareTemplate() public méthode

Define constants after including files.
public prepareTemplate ( Text_Template $template )
$template Text_Template

remove_added_uploads() public méthode

reset__SERVER() protected méthode

Reset $_SERVER variables
protected reset__SERVER ( )

reset_post_statuses() protected méthode

Unregister non-built-in post statuses.
protected reset_post_statuses ( )

reset_post_types() protected méthode

Run before each test in order to clean up the global scope, in case a test forgets to unregister a post type on its own, or fails before it has a chance to do so.
protected reset_post_types ( )

reset_taxonomies() protected méthode

Run before each test in order to clean up the global scope, in case a test forgets to unregister a taxonomy on its own, or fails before it has a chance to do so.
protected reset_taxonomies ( )

rmdir() public méthode

public rmdir ( $path )

scan_user_uploads() public méthode

public scan_user_uploads ( )

scandir() public méthode

public scandir ( $dir )

setExpectedDeprecated() public méthode

Declare an expected _deprecated_function() or _deprecated_argument() call from within a test.
Since: 4.2.0
public setExpectedDeprecated ( string $deprecated )
$deprecated string Name of the function, method, class, or argument that is deprecated. Must match first parameter of the `_deprecated_function()` or `_deprecated_argument()` call.

setExpectedIncorrectUsage() public méthode

Declare an expected _doing_it_wrong() call from within a test.
Since: 4.2.0
public setExpectedIncorrectUsage ( $doing_it_wrong )

setUp() public méthode

public setUp ( )

setUpBeforeClass() public static méthode

public static setUpBeforeClass ( )

start_transaction() public méthode

public start_transaction ( )

tearDown() public méthode

After a test method runs, reset any state in WordPress the test method might have changed.
public tearDown ( )

tearDownAfterClass() public static méthode

public static tearDownAfterClass ( )

temp_filename() public méthode

Returns the name of a temporary file
public temp_filename ( )

wp_die_handler() public méthode

public wp_die_handler ( $message )

Property Details

$caught_deprecated protected_oe property

protected $caught_deprecated

$caught_doing_it_wrong protected_oe property

protected $caught_doing_it_wrong

$expected_deprecated protected_oe property

protected $expected_deprecated

$expected_doing_it_wrong protected_oe property

protected $expected_doing_it_wrong

$forced_tickets protected_oe static_oe property

protected static $forced_tickets

$hooks_saved protected_oe static_oe property

protected static $hooks_saved

$ignore_files protected_oe static_oe property

protected static $ignore_files