Changeset 42343 for trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php
r37075 r42343 13 13 parent::setUp(); 14 14 15 $this->post_id = self::factory()->post->create( array( 16 'post_title' => 'Foo Bar', 17 'post_name' => 'foo-bar', 18 ) ); 15 $this->post_id = self::factory()->post->create( 16 array( 17 'post_title' => 'Foo Bar', 18 'post_name' => 'foo-bar', 19 ) 20 ); 19 21 20 22 add_filter( 'old_slug_redirect_url', array( $this, 'filter_old_slug_redirect_url' ), 10, 1 ); … … 39 41 $old_permalink = user_trailingslashit( get_permalink( $this->post_id ) ); 40 42 41 wp_update_post( array( 42 'ID' => $this->post_id, 43 'post_name' => 'bar-baz', 44 ) ); 43 wp_update_post( 44 array( 45 'ID' => $this->post_id, 46 'post_name' => 'bar-baz', 47 ) 48 ); 45 49 46 50 $permalink = user_trailingslashit( get_permalink( $this->post_id ) ); … … 53 57 public function test_old_slug_redirect_attachment() { 54 58 $file = DIR_TESTDATA . '/images/canola.jpg'; 55 $attachment_id = self::factory()->attachment->create_object( $file, $this->post_id, array( 56 'post_mime_type' => 'image/jpeg', 57 'post_name' => 'my-attachment', 58 ) ); 59 $attachment_id = self::factory()->attachment->create_object( 60 $file, $this->post_id, array( 61 'post_mime_type' => 'image/jpeg', 62 'post_name' => 'my-attachment', 63 ) 64 ); 59 65 60 66 $old_permalink = get_attachment_link( $attachment_id ); 61 67 62 wp_update_post( array( 63 'ID' => $this->post_id, 64 'post_name' => 'bar-baz', 65 ) ); 68 wp_update_post( 69 array( 70 'ID' => $this->post_id, 71 'post_name' => 'bar-baz', 72 ) 73 ); 66 74 67 75 $this->go_to( $old_permalink ); … … 72 80 $old_permalink = get_attachment_link( $attachment_id ); 73 81 74 wp_update_post( array( 75 'ID' => $attachment_id, 76 'post_name' => 'the-attachment', 77 ) ); 82 wp_update_post( 83 array( 84 'ID' => $attachment_id, 85 'post_name' => 'the-attachment', 86 ) 87 ); 78 88 79 89 $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'the-attachment' ); … … 85 95 86 96 public function test_old_slug_redirect_paged() { 87 wp_update_post( array( 88 'ID' => $this->post_id, 89 'post_content' => 'Test<!--nextpage-->Test', 90 ) ); 97 wp_update_post( 98 array( 99 'ID' => $this->post_id, 100 'post_content' => 'Test<!--nextpage-->Test', 101 ) 102 ); 91 103 92 104 $old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'page/2' ); 93 105 94 wp_update_post( array( 95 'ID' => $this->post_id, 96 'post_name' => 'bar-baz', 97 ) ); 106 wp_update_post( 107 array( 108 'ID' => $this->post_id, 109 'post_name' => 'bar-baz', 110 ) 111 ); 98 112 99 113 $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'page/2' ); … … 110 124 $old_permalink = user_trailingslashit( get_permalink( $this->post_id ) ); 111 125 112 wp_update_post( array( 113 'ID' => $this->post_id, 114 'post_name' => 'bar-baz', 115 ) ); 126 wp_update_post( 127 array( 128 'ID' => $this->post_id, 129 'post_name' => 'bar-baz', 130 ) 131 ); 116 132 117 $new_post_id = self::factory()->post->create( array( 118 'post_title' => 'Foo Bar', 119 'post_name' => 'foo-bar', 120 ) ); 133 $new_post_id = self::factory()->post->create( 134 array( 135 'post_title' => 'Foo Bar', 136 'post_name' => 'foo-bar', 137 ) 138 ); 121 139 122 140 $permalink = user_trailingslashit( get_permalink( $new_post_id ) );
Note: See TracChangeset
for help on using the changeset viewer.