PHP Class Codeception\Module\WPQueries

WordPress queries based assertions.
Inheritance: extends Codeception\Module
Show file Open project: lucatume/wp-browser

Protected Properties

Property Type Description
$assertions callable[]
$filteredQueries array
$wpdb wpdb

Public Methods

Method Description
__construct ( Codeception\Lib\ModuleContainer $moduleContainer, null $config, tad\WPBrowser\Environment\Constants $constants = null, wpdb | null $wpdb = null ) WPQueries constructor.
_cleanup ( ) Runs before each test method.
_getFilteredQueriesIterator ( wpdb $wpdb = null ) : FilterIterator Returns the saved queries after filtering.
_initialize ( )
assertCountQueries ( integer $n, string $message = '' ) Asserts that n queries have been made.
assertNotQueries ( string $message = '' ) Asserts that no queries were made.
assertNotQueriesByAction ( string $action, string $message = '' ) Asserts that no queries were made as a consequence of the specified action.
assertNotQueriesByFilter ( string $filter, string $message = '' ) Asserts that no queries were made as a consequence of the specified filter.
assertNotQueriesByFunction ( string $function, string $message = '' ) Asserts that no queries were made by the specified function.
assertNotQueriesByMethod ( $class, $method, string $message = '' ) Asserts that no queries have been made by the specified class method.
assertNotQueriesByStatement ( string $statement, string $message = '' ) Asserts that no queries have been made by the specified class method.
assertNotQueriesByStatementAndAction ( string $statement, string $action, string $message = '' ) Asserts that no queries were made as a consequence of the specified action containing the specified SQL statement.
assertNotQueriesByStatementAndFilter ( string $statement, string $filter, string $message = '' ) Asserts that no queries were made as a consequence of the specified filter containing the specified SQL statement.
assertNotQueriesByStatementAndFunction ( string $statement, string $function, string $message = '' ) Asserts that no queries were made by the specified function starting with the specified SQL statement.
assertNotQueriesByStatementAndMethod ( string $statement, string $class, string $method, string $message = '' ) Asserts that no queries were made by the specified class method starting with the specified SQL statement.
assertQueries ( string $message = '' ) Asserts that at least one query was made during the test.
assertQueriesByAction ( string $action, string $message = '' ) Asserts that at least one query was made as a consequence of the specified action.
assertQueriesByFilter ( string $filter, string $message = '' ) Asserts that at least one query was made as a consequence of the specified filter.
assertQueriesByFunction ( string $function, string $message = '' ) Asserts that queries were made by the specified function.
assertQueriesByMethod ( string $class, string $method, string $message = '' ) Asserts that at least one query has been made by the specified class method.
assertQueriesByStatement ( string $statement, string $message = '' ) Asserts that at least a query starting with the specified statement was made.
assertQueriesByStatementAndAction ( string $statement, string $action, string $message = '' ) Asserts that at least one query was made as a consequence of the specified action containing the specified SQL statement.
assertQueriesByStatementAndFilter ( string $statement, string $filter, string $message = '' ) Asserts that at least one query was made as a consequence of the specified filter containing the specified SQL statement.
assertQueriesByStatementAndFunction ( string $statement, string $function, string $message = '' ) Asserts that queries were made by the specified function starting with the specified SQL statement.
assertQueriesByStatementAndMethod ( string $statement, string $class, string $method, string $message = '' ) Asserts that queries were made by the specified class method starting with the specified SQL statement.
assertQueriesCountByAction ( integer $n, string $action, string $message = '' ) Asserts that n queries were made as a consequence of the specified action.
assertQueriesCountByFilter ( integer $n, string $filter, string $message = '' ) Asserts that n queries were made as a consequence of the specified filter.
assertQueriesCountByFunction ( integer $n, string $function, string $message = '' ) Asserts that n queries were made by the specified function.
assertQueriesCountByMethod ( integer $n, string $class, string $method, string $message = '' ) Asserts that n queries have been made by the specified class method.
assertQueriesCountByStatement ( integer $n, string $statement, string $message = '' ) Asserts that n queries starting with the specified statement were made.
assertQueriesCountByStatementAndAction ( integer $n, string $statement, string $action, string $message = '' ) Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement.
assertQueriesCountByStatementAndFilter ( integer $n, string $statement, string $filter, string $message = '' ) Asserts that n queries were made as a consequence of the specified filter containing the specified SQL statement.
assertQueriesCountByStatementAndFunction ( integer $n, string $statement, string $function, string $message = '' ) Asserts that n queries were made by the specified function starting with the specified SQL statement.
assertQueriesCountByStatementAndMethod ( integer $n, string $statement, string $class, string $method, string $message = '' ) Asserts that n queries were made by the specified class method starting with the specified SQL statement.

Private Methods

Method Description
getWpdbInstance ( ) : wpdb
readQueries ( )

Method Details

__construct() public method

WPQueries constructor.
public __construct ( Codeception\Lib\ModuleContainer $moduleContainer, null $config, tad\WPBrowser\Environment\Constants $constants = null, wpdb | null $wpdb = null )
$moduleContainer Codeception\Lib\ModuleContainer
$config null
$constants tad\WPBrowser\Environment\Constants
$wpdb wpdb | null

_cleanup() public method

Runs before each test method.
public _cleanup ( )

_getFilteredQueriesIterator() public method

Returns the saved queries after filtering.
public _getFilteredQueriesIterator ( wpdb $wpdb = null ) : FilterIterator
$wpdb wpdb
return FilterIterator

_initialize() public method

public _initialize ( )

assertCountQueries() public method

Asserts that n queries have been made.
public assertCountQueries ( integer $n, string $message = '' )
$n integer The expected number of queries.
$message string An optional message to override the default one.

assertNotQueries() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueries ( string $message = '' )
$message string An optional message to override the default one.

assertNotQueriesByAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByAction ( string $action, string $message = '' )
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertNotQueriesByFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByFilter ( string $filter, string $message = '' )
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertNotQueriesByFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByFunction ( string $function, string $message = '' )
$function string
$message string An optional message to override the default one.

assertNotQueriesByMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByMethod ( $class, $method, string $message = '' )
$class
$method
$message string An optional message to override the default one.

assertNotQueriesByStatement() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByStatement ( string $statement, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$message string An optional message to override the default one.

assertNotQueriesByStatementAndAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByStatementAndAction ( string $statement, string $action, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertNotQueriesByStatementAndFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByStatementAndFilter ( string $statement, string $filter, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertNotQueriesByStatementAndFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByStatementAndFunction ( string $statement, string $function, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$function string
$message string An optional message to override the default one.

assertNotQueriesByStatementAndMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertNotQueriesByStatementAndMethod ( string $statement, string $class, string $method, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$class string
$method string
$message string An optional message to override the default one.

assertQueries() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueries ( string $message = '' )
$message string An optional message to override the default one.

assertQueriesByAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByAction ( string $action, string $message = '' )
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertQueriesByFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByFilter ( string $filter, string $message = '' )
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertQueriesByFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByFunction ( string $function, string $message = '' )
$function string
$message string An optional message to override the default one.

assertQueriesByMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByMethod ( string $class, string $method, string $message = '' )
$class string
$method string
$message string An optional message to override the default one.

assertQueriesByStatement() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByStatement ( string $statement, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$message string An optional message to override the default one.

assertQueriesByStatementAndAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByStatementAndAction ( string $statement, string $action, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertQueriesByStatementAndFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByStatementAndFilter ( string $statement, string $filter, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertQueriesByStatementAndFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByStatementAndFunction ( string $statement, string $function, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$function string
$message string An optional message to override the default one.

assertQueriesByStatementAndMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesByStatementAndMethod ( string $statement, string $class, string $method, string $message = '' )
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$class string
$method string
$message string An optional message to override the default one.

assertQueriesCountByAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByAction ( integer $n, string $action, string $message = '' )
$n integer The expected number of queries.
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertQueriesCountByFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByFilter ( integer $n, string $filter, string $message = '' )
$n integer The expected number of queries.
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertQueriesCountByFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByFunction ( integer $n, string $function, string $message = '' )
$n integer The expected number of queries.
$function string
$message string An optional message to override the default one.

assertQueriesCountByMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByMethod ( integer $n, string $class, string $method, string $message = '' )
$n integer The expected number of queries.
$class string
$method string
$message string An optional message to override the default one.

assertQueriesCountByStatement() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByStatement ( integer $n, string $statement, string $message = '' )
$n integer The expected number of queries.
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$message string An optional message to override the default one.

assertQueriesCountByStatementAndAction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByStatementAndAction ( integer $n, string $statement, string $action, string $message = '' )
$n integer The expected number of queries.
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$action string The action name, e.g. 'init'.
$message string An optional message to override the default one.

assertQueriesCountByStatementAndFilter() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByStatementAndFilter ( integer $n, string $statement, string $filter, string $message = '' )
$n integer The expected number of queries.
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$filter string The filter name, e.g. 'posts_where'.
$message string An optional message to override the default one.

assertQueriesCountByStatementAndFunction() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByStatementAndFunction ( integer $n, string $statement, string $function, string $message = '' )
$n integer The expected number of queries.
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$function string
$message string An optional message to override the default one.

assertQueriesCountByStatementAndMethod() public method

Queries generated by setUp, tearDown and factory methods are excluded by default.
public assertQueriesCountByStatementAndMethod ( integer $n, string $statement, string $class, string $method, string $message = '' )
$n integer The expected number of queries.
$statement string A simple string the statement should start with or a valid regular expression. Regular expressions must contain delimiters.
$class string
$method string
$message string An optional message to override the default one.

Property Details

$assertions protected property

protected callable[] $assertions
return callable[]

$filteredQueries protected property

protected array $filteredQueries
return array

$wpdb protected property

protected wpdb $wpdb
return wpdb