Skip to content

Commit

Permalink
Use factories instead of wp_inster_* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Nov 29, 2024
1 parent 80bb13f commit cf9a13d
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ public function test_get_seo_scores( $inserted_posts, $taxonomy_filter, $expecte
foreach ( $post['meta_input'] as $meta_key => $meta_value ) {
$meta_input[ $meta_key ] = $meta_value;
}
\wp_insert_post(

$this->factory()->post->create(
[
'post_title' => 'Test Post' . $key,
'post_status' => 'publish',
Expand Down Expand Up @@ -285,15 +286,17 @@ public function test_get_seo_scores( $inserted_posts, $taxonomy_filter, $expecte
* @return array<string,bool>
*/
public static function data_provider_get_seo_scores() {
$term = \wp_insert_term(
'Test category',
'category',
$term = self::factory()->term->create_and_get(
[
'slug' => 'test-category',
'name' => 'Test category',
'taxonomy' => 'category',
[
'slug' => 'test-category',
],
]
);

$term_id = $term['term_id'];
$term_id = $term->term_id;
$term_slug = 'test-category';

$inserted_posts_in_multiple_terms = [
Expand Down

0 comments on commit cf9a13d

Please sign in to comment.