Changeset 21 in tests for wp-testcase/test_user.php
- Timestamp:
- 09/22/2007 02:44:11 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_user.php
r20 r21 8 8 9 9 function setUp() { 10 parent::setUp(); 10 11 // keep track of users we create 11 12 $user_ids = array(); … … 13 14 14 15 function tearDown() { 16 parent::tearDown(); 15 17 // delete any users that were created during tests 16 18 foreach ($this->user_ids as $id) … … 120 122 // get the complete usermeta array 121 123 $out = get_usermeta($user_id); 122 124 123 125 // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere. 124 126 // so we'll just check to make sure our values are included somewhere. … … 138 140 } 139 141 } 142 143 // simple test for user dropdown 144 function test_wp_dropdown_users() { 145 // add some users 146 foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $role) { 147 $id = $this->_make_user($role, "test-{$role}"); 148 $user[] = $id; 149 } 150 151 $expected = <<<EOF 152 <select name='user' id='user' class=''> 153 <option value='1'>{$this->author->display_name}</option> 154 <option value='{$user[0]}'>test-administrator</option> 155 <option value='{$user[1]}'>test-editor</option> 156 <option value='{$user[2]}'>test-author</option> 157 <option value='{$user[3]}'>test-contributor</option> 158 <option value='{$user[4]}'>test-subscriber</option> 159 </select> 160 EOF; 161 162 $out = wp_dropdown_users('echo=0&orderby=ID'); 163 164 $this->assertEquals(strip_ws($expected), strip_ws($out)); 165 } 140 166 } 141 167
Note: See TracChangeset
for help on using the changeset viewer.