src/Codeception/Module/WPDb.php
public function haveManyPostsInDatabase($count, array $overrides = [])
    {
        if (!is_int($count)) {
            throw new \InvalidArgumentException('Count must be an integer value');
        }
        $overrides = $this->setTemplateData($overrides);
        $ids = [];
        for ($i = 0; $i < $count; $i++) {
            $thisOverrides = $this->replaceNumbersInArray($overrides, $i);
            $ids[] = $this->havePostInDatabase($thisOverrides);
        }

        return $ids;
    }
public function haveManyPostsInDatabase($count, array $overrides = [])
    {
        if (!is_int($count)) {
            throw new \InvalidArgumentException('Count must be an integer value');
        }
        $overrides = $this->setTemplateData($overrides);
        $ids = [];
        for ($i = 0; $i < $count; $i++) {
            $thisOverrides = $this->replaceNumbersInArray($overrides, $i);
            $ids[] = $this->havePostInDatabase($thisOverrides);
        }

        return $ids;
    }
public function haveManyPostsInDatabase ( $ count , array $ overrides = [ ] ) { if ( ! is_int ( $ count ) ) { throw new \ InvalidArgumentException ( 'Count must be an integer value' ) ; } $ overrides = $ this -> setTemplateData ( $ overrides ) ; $ ids = [ ] ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ thisOverrides = $ this -> replaceNumbersInArray ( $ overrides , $ i ) ; $ ids [ ] = $ this -> havePostInDatabase ( $ thisOverrides ) ; } return $ ids ; }
Inserts many posts in the database returning their IDs.

@param int   $count     The number of posts to insert.
@param array $overrides {
An array of values to override the defaults.
The `{{n}}` placeholder can be used to have the post count inserted in its place;
e.g. `Post Title - {{n}}` will be set to `Post Title - 0` for the first post,
`Post Title - 1` for the second one and so on.
The same applies to meta values as well.

@type array  $meta      An associative array of meta key/values to be set for the post, shorthand for the
`havePostmetaInDatabase` method. e.g. `['one' => 'foo', 'two' => 'bar']`; to have an array value inserted
in a single row serialize it e.g.
`['serialized_field` => serialize(['one','two','three'])]` otherwise a distinct row will be
added for each entry. See `havePostmetaInDatabase` method.
}

@example
```php
// Insert 3 random posts.
$I->haveManyPostsInDatabase(3);
// Insert 3 posts with generated titles.
$I->haveManyPostsInDatabase(3, ['post_title' => 'Test post {{n}}']);
```

@return array An array of the inserted post IDs.
Inserts many posts in the database returning their IDs .