Changeset 41720 for trunk/tests/phpunit/tests/customize/manager.php
- Timestamp:
- 10/04/2017 12:00:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/customize/manager.php
r41648 r41720 152 152 */ 153 153 public function test_constructor_deferred_changeset_uuid() { 154 wp_set_current_user( self::$admin_user_id ); 155 $other_admin_user_id = $this->factory()->user->create( array( 'role' => 'admin' ) ); 156 154 157 $data = array( 155 158 'blogname' => array( … … 157 160 ), 158 161 ); 159 $uuid = wp_generate_uuid4(); 162 163 $uuid1 = wp_generate_uuid4(); 164 $this->factory()->post->create( array( 165 'post_type' => 'customize_changeset', 166 'post_name' => $uuid1, 167 'post_status' => 'draft', 168 'post_content' => wp_json_encode( $data ), 169 'post_author' => get_current_user_id(), 170 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( '-2 days' ) ), 171 ) ); 172 173 /* 174 * Create a changeset for another user that is newer to ensure that it is the one that gets returned, 175 * as in non-branching mode there should only be one pending changeset at a time. 176 */ 177 $uuid2 = wp_generate_uuid4(); 160 178 $post_id = $this->factory()->post->create( array( 161 179 'post_type' => 'customize_changeset', 162 'post_name' => $uuid ,180 'post_name' => $uuid2, 163 181 'post_status' => 'draft', 164 182 'post_content' => wp_json_encode( $data ), 165 ) ); 183 'post_author' => $other_admin_user_id, 184 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( '-1 day' ) ), 185 ) ); 186 166 187 $wp_customize = new WP_Customize_Manager( array( 167 188 'changeset_uuid' => false, // Cause UUID to be deferred. 168 189 'branching' => false, // To cause drafted changeset to be autoloaded. 169 190 ) ); 170 $this->assertEquals( $uuid , $wp_customize->changeset_uuid() );191 $this->assertEquals( $uuid2, $wp_customize->changeset_uuid() ); 171 192 $this->assertEquals( $post_id, $wp_customize->changeset_post_id() ); 193 194 $wp_customize = new WP_Customize_Manager( array( 195 'changeset_uuid' => false, // Cause UUID to be deferred. 196 'branching' => true, // To cause no drafted changeset to be autoloaded. 197 ) ); 198 $this->assertNotContains( $wp_customize->changeset_uuid(), array( $uuid1, $uuid2 ) ); 199 $this->assertEmpty( $wp_customize->changeset_post_id() ); 172 200 } 173 201
Note: See TracChangeset
for help on using the changeset viewer.