Codeception\Module\WPQueries::assertQueriesCountByFunction PHP Method

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