PHP Class Codeception\TestCase\WPTestCase

Inheritance: extends Codeception\Test\Unit
Datei anzeigen Open project: lucatume/wp-browser Class Usage Examples

Protected Properties

Property Type Description
$backupGlobals
$caught_deprecated
$caught_doing_it_wrong
$expected_deprecated
$expected_doing_it_wrong
$forced_tickets
$hooks_saved
$ignore_files

Public Methods

Method 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 ( $url )
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.
queries ( ) : WPQueries Returns the WPQueries module instance.
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 ( )
tearDownAfterClass ( )
temp_filename ( ) Returns the name of a temporary file
unlink ( $file )
wp_die_handler ( $message )

Protected Methods

Method 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_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 method

public __get ( $name )

__isset() public method

public __isset ( $name )

_backup_hooks() protected method

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
return void

_create_temporary_tables() public method

public _create_temporary_tables ( $query )

_drop_temporary_tables() public method

public _drop_temporary_tables ( $query )

_make_attachment() public method

public _make_attachment ( $upload, $parent_post_id )

_microtime_to_float() protected method

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

_restore_hooks() protected method

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
return void

assertDiscardWhitespace() public method

public assertDiscardWhitespace ( $expected, $actual )

assertEqualFields() public method

public assertEqualFields ( $object, $fields )

assertEqualSets() public method

public assertEqualSets ( $expected, $actual )

assertEqualSetsWithIndex() public method

public assertEqualSetsWithIndex ( $expected, $actual )

assertNotWPError() public method

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

assertPostConditions() protected method

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

assertQueryTrue() public method

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 method

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

checkRequirements() protected method

protected checkRequirements ( )

clean_up_global_scope() public method

commit_transaction() public static method

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

delete_folders() public method

public delete_folders ( $path )

delete_user() public static method

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

deprecated_function_run() public method

public deprecated_function_run ( $function )

doing_it_wrong_run() public method

public doing_it_wrong_run ( $function )

expectDeprecated() public method

public expectDeprecated ( )

expectedDeprecated() public method

public expectedDeprecated ( )

factory() protected static method

protected static factory ( )

files_in_dir() public method

public files_in_dir ( $dir )

flush_cache() public method

public flush_cache ( )

forceTicket() public static method

public static forceTicket ( $ticket )

get_called_class() public static method

public static get_called_class ( )

get_wp_die_handler() public method

public get_wp_die_handler ( $handler )

go_to() public method

public go_to ( $url )

knownPluginBug() public method

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

knownUTBug() public method

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

knownWPBug() public method

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

prepareTemplate() public method

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

queries() public method

Returns the WPQueries module instance.
public queries ( ) : WPQueries
return Codeception\Module\WPQueries

remove_added_uploads() public method

reset_post_statuses() protected method

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

reset_post_types() protected method

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 method

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 method

public rmdir ( $path )

scan_user_uploads() public method

public scan_user_uploads ( )

scandir() public method

public scandir ( $dir )

setExpectedDeprecated() public method

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 method

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

setUp() public method

public setUp ( )

setUpBeforeClass() public static method

public static setUpBeforeClass ( )

start_transaction() public method

public start_transaction ( )

tearDown() public method

public tearDown ( )

tearDownAfterClass() public static method

public static tearDownAfterClass ( )

temp_filename() public method

Returns the name of a temporary file
public temp_filename ( )

wp_die_handler() public method

public wp_die_handler ( $message )

Property Details

$backupGlobals protected_oe property

protected $backupGlobals

$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