diff --git a/tests/test-automatically-paginate-posts.php b/tests/test-automatically-paginate-posts.php index c3fad45d3415e3bd42de3186dca4bfeba6b7690b..cc876466bd1a6d55ca4c47bb0ee3715d1edca793 100755 --- a/tests/test-automatically-paginate-posts.php +++ b/tests/test-automatically-paginate-posts.php @@ -112,8 +112,18 @@ class Test_Automatically_Paginate_Posts extends WP_UnitTestCase { $post = $this->factory->post->create_and_get( $input['post_args'] ); update_option( 'autopaging_paging_type', $input['type'] ); - update_option( 'autopaging_num_pages', $input['num_pages'] ); - update_option( 'autopaging_num_words', $input['num_words'] ); + add_filter( + 'autopaging_num_pages', + static function() use( $input ) { + return $input['num_pages']; + } + ); + add_filter( + 'autopaging_num_words', + static function() use( $input ) { + return $input['num_words']; + } + ); $this->assertEquals( $expected, @@ -164,6 +174,18 @@ class Test_Automatically_Paginate_Posts extends WP_UnitTestCase { 'num_words' => 2, ), ), + 'Classic post, three pages' => array( + "1<!--nextpage-->\r\n\r\n2<!--nextpage-->\r\n\r\n3", + array( + 'post_args' => array( + 'post_type' => 'post', + 'post_content' => "1\r\n\r\n2\r\n\r\n3", + ), + 'type' => 'pages', + 'num_pages' => 3, + 'num_words' => 2, + ), + ), ); } }