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

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

@example
```php
Acme\BookRepository::new(['title' => 'Alice in Wonderland'])->commit();
Acme\BookRepository::new(['title' => 'Moby-Dick'])->commit();
Acme\BookRepository::new(['title' => 'The Call of the Wild'])->commit();
$this->assertQueriesCountByStatementAndMethod(3, 'INSERT', Acme\BookRepository::class, 'commit');
```

@param int $n The expected number of queries.
@param string $statement A simple string the statement should start with or a valid regular expression.
Regular expressions must contain delimiters.
@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 were made by the specified class method starting with the specified SQL statement .