Codeception\Module\WPQueries::assertQueriesCountByStatementAndAction PHP Method

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.
    public function assertQueriesCountByStatementAndAction($n, $statement, $action, $message = '')
    {
        $this->readQueries();
        $message = $message ? $message : 'Failed asserting that ' . $n . ' queries were triggered by action  [' . $action . '] containing statement [' . $statement . ']';
        $iterator = new MainStatementQueriesFilter(new ActionsQueriesFilter(new \ArrayIterator($this->filteredQueries), $action), $statement);
        \PHPUnit_Framework_Assert::assertCount($n, iterator_to_array($iterator), $message);
    }