src/Codeception/Module/WPQueries.php
public function assertQueriesCountByStatementAndAction($n, $statement, $action, $message = '')
    {
        $this->readQueries();
        $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);
        Assert::assertCount($n, iterator_to_array($iterator), $message);
    }
public function assertQueriesCountByStatementAndAction($n, $statement, $action, $message = '')
    {
        $this->readQueries();
        $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);
        Assert::assertCount($n, iterator_to_array($iterator), $message);
    }
public function assertQueriesCountByStatementAndAction ( $ n , $ statement , $ action , $ message = '' ) { $ this -> readQueries ( ) ; $ 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 ) ; Assert :: assertCount ( $ n , iterator_to_array ( $ iterator ) , $ message ) ; }
Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement.

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

@example
```php
add_action( 'edit_post', function($postId){
$count = get_option('acme_title_updates_count');
update_option('acme_title_updates_count', ++$count);
} );
wp_delete_post($bookOneId);
wp_delete_post($bookTwoId);
wp_update_post(['ID' => $bookThreeId, 'post_title' => 'New']);
$this->assertQueriesCountByStatementAndAction(2, 'DELETE', 'delete_post');
$this->assertQueriesCountByStatementAndAction(1, 'INSERT', 'edit_post');
```

@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 $action The action name, e.g. 'init'.
@param string $message An optional message to override the default one.
Asserts that n queries were made as a consequence of the specified action containing the specified SQL statement .