Skip to content

Create Demo_Posts_Creation_Preparation #40

@mehulkaklotar

Description

@mehulkaklotar

Description

Demo post creation preparation will ensure that the plugin being checked is provided with all the necessary posts it needs to conduct the audit.

Acceptance Criteria

  • Class Demo_Posts_Creation_Preparation should be created and exists at includes/Checker/Preparations
  • Class Demo_Posts_Creation_Preparation should extend Preparation interface
  • Class Demo_Posts_Creation_Preparation has a constructor.
    • The constructor accepts a $posts parameter
    • The $posts parameter passed will be an array of posts data. Each item in the array will contain post data compatible with the wp_insert_post() function.
    • The post data passed will be assigned to a protected property to be used later.
  • prepare() must be implemented from Preparation interface
    • The method will loop over the post data array passed in the constructor and create each post using the wp_insert_post() function.
    • For each post successfully created, the post ID returned will be stored in an array.
    • The cleanup function returned will loop over the array of post IDs created and remove each post from the database.

Tests Coverage

  • Demo_Posts_Creation_Preparation instance expected to be implementing of Preparation interface
  • prepare() method adds the passed posts to the database.
  • The cleanup function returned by prepare() removes the posts from the database.

Metadata

Metadata

Assignees

Labels

InfrastructureIssues for the overall plugin infrastructure[Type] EnhancementA suggestion for improvement of an existing feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions