Changeset 47317 for trunk/tests/phpunit/tests/post.php
- Timestamp:
- 02/19/2020 03:50:38 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post.php
r47198 r47317 1119 1119 1120 1120 /** 1121 * If a post is sticky and is updated by a user that does not have the publish_post capability, it should _stay_1122 * sticky.1121 * If a post is sticky and is updated by a user that does not have the publish_post capability, 1122 * it should _stay_ sticky. 1123 1123 * 1124 1124 * @ticket 24153 … … 1157 1157 1158 1158 /** 1159 * If the `edit_post()` method is invoked by a user without publish_posts permission, the sticky status of the post1160 * should not be changed.1159 * If the `edit_post()` method is invoked by a user without publish_posts permission, 1160 * the sticky status of the post should not be changed. 1161 1161 * 1162 1162 * @ticket 24153 … … 1427 1427 self::assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( $post->post_date_gmt ), 'The dates should be equal', 2 ); 1428 1428 } 1429 1430 /** 1431 * Test ensuring that wp_update_post() does not unintentionally modify post tags 1432 * if the post has several tags with the same name but different slugs. 1433 * 1434 * Tags should only be modified if 'tags_input' parameter was explicitly provided, 1435 * and is different from the existing tags. 1436 * 1437 * @ticket 45121 1438 */ 1439 public function test_update_post_should_only_modify_post_tags_if_different_tags_input_was_provided() { 1440 $tag_1 = wp_insert_term( 'wp_update_post_tag', 'post_tag', array( 'slug' => 'wp_update_post_tag_1' ) ); 1441 $tag_2 = wp_insert_term( 'wp_update_post_tag', 'post_tag', array( 'slug' => 'wp_update_post_tag_2' ) ); 1442 $tag_3 = wp_insert_term( 'wp_update_post_tag', 'post_tag', array( 'slug' => 'wp_update_post_tag_3' ) ); 1443 1444 $post_id = self::factory()->post->create( 1445 array( 1446 'tags_input' => array( $tag_1['term_id'], $tag_2['term_id'] ), 1447 ) 1448 ); 1449 1450 $post = get_post( $post_id ); 1451 1452 $tags = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) ); 1453 $this->assertEqualSets( array( $tag_1['term_id'], $tag_2['term_id'] ), $tags ); 1454 1455 wp_update_post( $post ); 1456 1457 $tags = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) ); 1458 $this->assertEqualSets( array( $tag_1['term_id'], $tag_2['term_id'] ), $tags ); 1459 1460 wp_update_post( 1461 array( 1462 'ID' => $post->ID, 1463 'tags_input' => array( $tag_2['term_id'], $tag_3['term_id'] ), 1464 ) 1465 ); 1466 1467 $tags = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) ); 1468 $this->assertEqualSets( array( $tag_2['term_id'], $tag_3['term_id'] ), $tags ); 1469 } 1429 1470 }
Note: See TracChangeset
for help on using the changeset viewer.