Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Aug 29, 2023
1 parent 2d965cd commit 5cc59f0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/phpunit/test-post-saving.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,20 @@ public function testPostAuthorshipIsSetToEmptyWhenUpdatingPostWithNoExistingAuth

remove_filter( 'authorship_default_author', '__return_empty_array' );
}

public function testMultiplePostInsertionDoesNotCompoundActions() : void {
global $wp_filter;

$before = count( $wp_filter['wp_insert_post']->callbacks );

for ( $i = 0; $i < 3; $i++ ) {
wp_insert_post( [
'post_title' => "Testing $i",
] );
}

$after = count( $wp_filter['wp_insert_post']->callbacks );

$this->assertSame( $before, $after );
}
}

0 comments on commit 5cc59f0

Please sign in to comment.