src/Codeception/Module/WPQueries.php
public function assertQueriesCountByMethod($n, $class, $method, $message = '')
    {
        $this->readQueries();
        $class = ltrim($class, '\\');
        $message = $message ?: 'Failed asserting that ' . $n . ' queries were made by method ['
                               . $class . '::' . $method . ']';
        $statementIterator = new ClassMethodQueriesFilter(new \ArrayIterator($this->filteredQueries), $class, $method);
        Assert::assertCount($n, iterator_to_array($statementIterator), $message);
    }
public function assertQueriesCountByMethod($n, $class, $method, $message = '')
    {
        $this->readQueries();
        $class = ltrim($class, '\\');
        $message = $message ?: 'Failed asserting that ' . $n . ' queries were made by method ['
                               . $class . '::' . $method . ']';
        $statementIterator = new ClassMethodQueriesFilter(new \ArrayIterator($this->filteredQueries), $class, $method);
        Assert::assertCount($n, iterator_to_array($statementIterator), $message);
    }
public function assertQueriesCountByMethod ( $ n , $ class , $ method , $ message = '' ) { $ this -> readQueries ( ) ; $ class = ltrim ( $ class , '\\' ) ; $ message = $ message ? : 'Failed asserting that ' . $ n . ' queries were made by method [' . $ class . '::' . $ method . ']' ; $ statementIterator = new ClassMethodQueriesFilter ( new \ ArrayIterator ( $ this -> filteredQueries ) , $ class , $ method ) ; Assert :: assertCount ( $ n , iterator_to_array ( $ statementIterator ) , $ message ) ; }
Asserts that n queries have been made by the specified class method.

Queries generated by `setUp`, `tearDown` and `factory` methods are excluded by default.

@example
```php
$bookRepository = new Acme\BookRepository();
$repository->where('ID', 23)->commit('title', 'Peter Pan');
$repository->where('ID', 89)->commit('title', 'Moby-dick');
$repository->where('ID', 2389)->commit('title', 'The call of the wild');
$this->assertQueriesCountByMethod(3, 'Acme\BookRepository', 'commit');
```
@param int $n The expected number of queries.
@param string $class The fully qualified name of the class to check.
@param string $method The name of the method to check.
@param string $message An optional message to override the default one.
Asserts that n queries have been made by the specified class method .