Codeception\Module\WPQueries::assertQueriesCountByAction PHP Method

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