Skip to content

Commit b3f5099

Browse files
authored
Merge pull request #334 from lloc/refactoring-version-2-8
Tests added
2 parents 31d4faf + acc36aa commit b3f5099

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/phpunit/TestMslsMetaBox.php

+12
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,16 @@ public function test_render_option_not_selected(): void {
5151

5252
$this->assertEquals( '<option value="1" >Test</option>', $this->test->render_option( 1, 2 ) );
5353
}
54+
55+
public function test_render_options() {
56+
$post = \Mockery::mock( 'WP_Post' );
57+
$post->ID = 42;
58+
59+
Functions\expect( 'get_posts' )->once()->andReturn( array( $post ) );
60+
Functions\expect( 'get_post_stati' )->once()->andReturn( array( 'pending', 'draft', 'future' ) );
61+
Functions\expect( 'selected' )->once()->andReturn( 'selected="selected"' );
62+
Functions\expect( 'get_the_title' )->once()->andReturn( 'A random title' );
63+
64+
$this->assertEquals( '<option value="42" selected="selected">A random title</option>', $this->test->render_options( 'post', 42 ) );
65+
}
5466
}

0 commit comments

Comments
 (0)