Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed May 3, 2018
2 parents dc0bcdb + dbb6ed0 commit 515e321
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test-sitemap-creation.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ function test_get_sitemap_post_id() {
function test_delete_empty_sitemap() {
global $wpdb;

$deleted_posts = get_option( 'msm_sitemap_deleted_posts', array() );
$this->assertEmpty( $deleted_posts, 'msm_sitemap_deleted_posts has an unexpected value' );

list( $sitemap ) = get_posts( array(
'post_type' => Metro_Sitemap::SITEMAP_CPT,
'posts_per_page' => 1,
Expand All @@ -144,6 +147,10 @@ function test_delete_empty_sitemap() {
wp_delete_post( $post_id, true );
}

$deleted_posts = get_option( 'msm_sitemap_deleted_posts', array() );
$this->assertNotEmpty( $deleted_posts, 'msm_sitemap_deleted_posts does not have deleted posts saved' );
$this->assertHasKey( 'ID', $deleted_posts[0], 'msm_sitemap_deleted_posts has an invalid format' );

MSM_Sitemap_Builder_Cron::generate_sitemap_for_year_month_day( array(
'year' => $year,
'month' => $month,
Expand Down

0 comments on commit 515e321

Please sign in to comment.