- Timestamp:
- 10/03/2015 05:14:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/getPostCommentsFeedLink.php
r34479 r34802 4 4 */ 5 5 class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase { 6 private static $rewrite;7 private static $permalink_structure;8 9 static function setUpBeforeClass() {10 global $wp_rewrite;11 12 parent::setUpBeforeClass();13 14 self::$rewrite = $wp_rewrite;15 self::$permalink_structure = get_option( 'permalink_structure' );16 }17 18 public static function tearDownAfterClass() {19 parent::tearDownAfterClass();20 21 self::$rewrite->init();22 self::$rewrite->set_permalink_structure( self::$permalink_structure );23 self::$rewrite->flush_rules();24 }25 26 public function setUp() {27 parent::setUp();28 self::$rewrite->init();29 }30 31 private function set_permalink_structure( $structure ) {32 self::$rewrite->set_permalink_structure( $structure );33 self::$rewrite->flush_rules();34 }35 6 36 7 public function test_post_link() { 37 $this->set_permalink_structure( '' );38 39 8 $post_id = $this->factory->post->create(); 40 9 … … 49 18 50 19 public function test_post_pretty_link() { 51 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 20 global $wp_rewrite; 21 $wp_rewrite->init(); 22 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 23 $wp_rewrite->flush_rules(); 52 24 53 25 $post_id = $this->factory->post->create(); … … 60 32 61 33 public function test_attachment_link() { 62 $this->set_permalink_structure( '' );63 64 34 $post_id = $this->factory->post->create(); 65 35 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array( … … 78 48 79 49 public function test_attachment_pretty_link() { 80 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 50 global $wp_rewrite; 51 $wp_rewrite->init(); 52 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 53 $wp_rewrite->flush_rules(); 81 54 82 55 $post_id = $this->factory->post->create( array( … … 98 71 99 72 public function test_attachment_no_name_pretty_link() { 100 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 73 global $wp_rewrite; 74 $wp_rewrite->init(); 75 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 76 $wp_rewrite->flush_rules(); 101 77 102 78 $post_id = $this->factory->post->create(); … … 113 89 114 90 public function test_unattached_link() { 115 $this->set_permalink_structure( '' );116 117 91 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array( 118 92 'post_mime_type' => 'image/jpeg', … … 130 104 131 105 public function test_unattached_pretty_link() { 132 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 106 global $wp_rewrite; 107 $wp_rewrite->init(); 108 $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 109 $wp_rewrite->flush_rules(); 133 110 134 111 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
Note: See TracChangeset
for help on using the changeset viewer.