Changeset 28399 for trunk/tests/phpunit/tests/post/template.php
- Timestamp:
- 05/15/2014 01:11:21 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/template.php
r28398 r28399 73 73 $this->assertEquals( $pagelink, $output ); 74 74 } 75 76 function test_wp_dropdown_pages() { 77 $none = wp_dropdown_pages( array( 'echo' => 0 ) ); 78 $this->assertEmpty( $none ); 79 80 $bump = ' '; 81 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) ); 82 $child_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) ); 83 $grandchild_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) ); 84 85 $lineage =<<<LINEAGE 86 <select name='page_id' id='page_id'> 87 <option class="level-0" value="$page_id">Post title 1</option> 88 <option class="level-1" value="$child_id">{$bump}Post title 2</option> 89 <option class="level-2" value="$grandchild_id">{$bump}{$bump}Post title 3</option> 90 </select> 91 92 LINEAGE; 93 94 $output = wp_dropdown_pages( array( 'echo' => 0 ) ); 95 $this->assertEquals( $lineage, $output ); 96 97 $depth =<<<DEPTH 98 <select name='page_id' id='page_id'> 99 <option class="level-0" value="$page_id">Post title 1</option> 100 </select> 101 102 DEPTH; 103 104 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1 ) ); 105 $this->assertEquals( $depth, $output ); 106 107 $option_none =<<<NONE 108 <select name='page_id' id='page_id'> 109 <option value="Woo">Hoo</option> 110 <option class="level-0" value="$page_id">Post title 1</option> 111 </select> 112 113 NONE; 114 115 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1, 116 'show_option_none' => 'Hoo', 'option_none_value' => 'Woo' 117 ) ); 118 $this->assertEquals( $option_none, $output ); 119 120 $option_no_change =<<<NO 121 <select name='page_id' id='page_id'> 122 <option value="-1">Burrito</option> 123 <option value="Woo">Hoo</option> 124 <option class="level-0" value="$page_id">Post title 1</option> 125 </select> 126 127 NO; 128 $output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1, 129 'show_option_none' => 'Hoo', 'option_none_value' => 'Woo', 130 'show_option_no_change' => 'Burrito' 131 ) ); 132 $this->assertEquals( $option_no_change, $output ); 133 } 75 134 }
Note: See TracChangeset
for help on using the changeset viewer.