diff --git a/tests/phpunit/TestMslsMetaBox.php b/tests/phpunit/TestMslsMetaBox.php index 1e1576ef..e7f1ea6f 100644 --- a/tests/phpunit/TestMslsMetaBox.php +++ b/tests/phpunit/TestMslsMetaBox.php @@ -51,4 +51,16 @@ public function test_render_option_not_selected(): void { $this->assertEquals( '', $this->test->render_option( 1, 2 ) ); } + + public function test_render_options() { + $post = \Mockery::mock( 'WP_Post' ); + $post->ID = 42; + + Functions\expect( 'get_posts' )->once()->andReturn( array( $post ) ); + Functions\expect( 'get_post_stati' )->once()->andReturn( array( 'pending', 'draft', 'future' ) ); + Functions\expect( 'selected' )->once()->andReturn( 'selected="selected"' ); + Functions\expect( 'get_the_title' )->once()->andReturn( 'A random title' ); + + $this->assertEquals( '', $this->test->render_options( 'post', 42 ) ); + } }