bigbite / wp-cypress

WordPress end to end testing with Cypress.io.
MIT License
88 stars 20 forks source link

Feature/generate comments #11

Closed liamdefty closed 4 years ago

liamdefty commented 4 years ago

This gives the ability to generate comments for a post, passing in any values available to wp_insert_comment with some default values and also giving the ability to attach comment meta.

Example

<?php

use \WP_Cypress\Seeder\Seeder;

class MySeeder extends Seeder {
    public function run() {
    $title = $this->faker->sentence();

        $this->generate->posts( [
            'post_title' => $title,
            'import_id'  => 10,
    ], 1 );

    $this->generate->comments( [
            'comment_post_ID' => 20,
        ], 10 );
    }
}