- Timestamp:
- 09/24/2015 04:19:56 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/getPostCommentsFeedLink.php
r34336 r34477 4 4 */ 5 5 class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase { 6 protected $permalink_structure; 7 8 function setUp() { 9 parent::setUp(); 10 11 $this->permalink_structure = get_option( 'permalink_structure' ); 12 } 13 14 function tearDown() { 15 $this->remove_added_uploads(); 16 17 parent::tearDown(); 18 19 $this->set_permalink_structure( $this->permalink_structure ); 20 } 21 22 public function set_permalink_structure( $permalink_structure ) { 6 public function test_post_link() { 23 7 global $wp_rewrite; 24 $wp_rewrite->set_permalink_structure( $permalink_structure ); 8 $permalink_structure = get_option( 'permalink_structure' ); 9 $wp_rewrite->init(); 10 $wp_rewrite->set_permalink_structure( '' ); 25 11 $wp_rewrite->flush_rules(); 26 }27 28 public function test_post_link() {29 $this->set_permalink_structure( '' );30 12 31 13 $post_id = $this->factory->post->create(); … … 41 23 42 24 public function test_post_pretty_link() { 43 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 25 global $wp_rewrite; 26 $permalink_structure = get_option( 'permalink_structure' ); 27 $wp_rewrite->init(); 28 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 29 $wp_rewrite->flush_rules(); 44 30 45 31 $post_id = $this->factory->post->create(); … … 52 38 53 39 public function test_attachment_link() { 54 $this->set_permalink_structure( '' ); 40 global $wp_rewrite; 41 $wp_rewrite->init(); 42 $wp_rewrite->set_permalink_structure( '' ); 43 $wp_rewrite->flush_rules(); 55 44 56 45 $post_id = $this->factory->post->create(); … … 70 59 71 60 public function test_attachment_pretty_link() { 72 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 61 global $wp_rewrite; 62 $wp_rewrite->init(); 63 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 64 $wp_rewrite->flush_rules(); 73 65 74 66 $post_id = $this->factory->post->create( array( … … 90 82 91 83 public function test_attachment_no_name_pretty_link() { 92 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 84 global $wp_rewrite; 85 $wp_rewrite->init(); 86 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 87 $wp_rewrite->flush_rules(); 93 88 94 89 $post_id = $this->factory->post->create(); … … 99 94 100 95 $link = get_post_comments_feed_link( $attachment_id ); 101 $expected = add_query_arg( array( 102 'feed' => get_default_feed(), 103 'p' => $attachment_id 104 ), home_url( '/' ) ); 105 96 $expected = get_permalink( $post_id ) . 'attachment/' . $attachment_id . '/feed/'; 97 106 98 $this->assertEquals( $expected, $link ); 107 99 } 108 100 109 101 public function test_unattached_link() { 110 $this->set_permalink_structure( '' ); 102 global $wp_rewrite; 103 $wp_rewrite->init(); 104 $wp_rewrite->set_permalink_structure( '' ); 105 $wp_rewrite->flush_rules(); 111 106 112 107 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array( … … 125 120 126 121 public function test_unattached_pretty_link() { 127 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 122 global $wp_rewrite; 123 $wp_rewrite->init(); 124 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 125 $wp_rewrite->flush_rules(); 128 126 129 127 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
Note: See TracChangeset
for help on using the changeset viewer.