Changeset 50463
- Timestamp:
- 03/01/2021 06:42:49 PM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php
r49603 r50463 19 19 unset( $GLOBALS['comment'] ); 20 20 parent::tearDown(); 21 22 add_filter( 'comment_email', 'antispambot' );23 21 } 24 22 -
trunk/tests/phpunit/tests/db.php
r49193 r50463 34 34 $this->_queries = array(); 35 35 add_filter( 'query', array( $this, 'query_filter' ) ); 36 }37 38 /**39 * Tear down the test fixture40 */41 public function tearDown() {42 remove_filter( 'query', array( $this, 'query_filter' ) );43 parent::tearDown();44 36 } 45 37 -
trunk/tests/phpunit/tests/formatting/ExcerptRemoveBlocks.php
r50450 r50463 84 84 $registry = WP_Block_Type_Registry::get_instance(); 85 85 $registry->unregister( 'core/fake' ); 86 wp_delete_post( self::$post_id, true );87 86 88 87 parent::tearDown(); -
trunk/tests/phpunit/tests/formatting/redirect.php
r50337 r50463 10 10 parent::setUp(); 11 11 add_filter( 'home_url', array( $this, 'home_url' ) ); 12 }13 14 function tearDown() {15 remove_filter( 'home_url', array( $this, 'home_url' ) );16 parent::tearDown();17 12 } 18 13 -
trunk/tests/phpunit/tests/functions/doEnclose.php
r49006 r50463 27 27 parent::setUp(); 28 28 add_filter( 'pre_http_request', array( $this, 'fake_http_request' ), 10, 3 ); 29 }30 31 /**32 * Cleanup after each test method.33 *34 * @since 5.3.035 */36 public function tearDown() {37 parent::tearDown();38 remove_filter( 'pre_http_request', array( $this, 'fake_http_request' ) );39 29 } 40 30 -
trunk/tests/phpunit/tests/general/wpGetDocumentTitle.php
r50339 r50463 54 54 } 55 55 56 function tearDown() {57 wp_reset_postdata();58 parent::tearDown();59 }60 61 56 function _add_title_tag_support() { 62 57 add_theme_support( 'title-tag' ); -
trunk/tests/phpunit/tests/general/wpResourceHints.php
r50392 r50463 28 28 $GLOBALS['wp_scripts'] = $this->old_wp_scripts; 29 29 $GLOBALS['wp_styles'] = $this->old_wp_styles; 30 add_action( 'wp_default_scripts', 'wp_default_scripts' );31 add_action( 'wp_default_styles', 'wp_default_styles' );32 30 parent::tearDown(); 33 31 } -
trunk/tests/phpunit/tests/http/base.php
r50344 r50463 40 40 } 41 41 42 function tearDown() {43 foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {44 remove_filter( "use_{$t}_transport", '__return_false' );45 }46 parent::tearDown();47 }48 49 42 function filter_http_request_args( array $args ) { 50 43 $this->http_request_args = $args; -
trunk/tests/phpunit/tests/http/wpGetHttpHeaders.php
r50345 r50463 15 15 // Hook a fake HTTP request response. 16 16 add_filter( 'pre_http_request', array( $this, 'fake_http_request' ), 10, 3 ); 17 }18 19 /**20 * Clean up environment21 */22 public function tearDown() {23 parent::tearDown();24 25 // Clear the hook for the fake HTTP request response.26 remove_filter( 'pre_http_request', array( $this, 'fake_http_request' ) );27 17 } 28 18 -
trunk/tests/phpunit/tests/image/base.php
r49009 r50463 17 17 18 18 add_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 ); 19 }20 21 /**22 * Undo the image editor override23 */24 public function tearDown() {25 remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );26 parent::tearDown();27 19 } 28 20 -
trunk/tests/phpunit/tests/image/resize.php
r49033 r50463 15 15 16 16 add_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) ); 17 }18 19 public function tearDown() {20 remove_filter( 'wp_image_editors', array( $this, 'wp_image_editors' ) );21 22 parent::tearDown();23 17 } 24 18 -
trunk/tests/phpunit/tests/import/import.php
r48937 r50463 32 32 $wpdb->query( "DELETE FROM {$wpdb->$table}" ); 33 33 } 34 }35 36 function tearDown() {37 remove_filter( 'import_allow_create_users', '__return_true' );38 39 parent::tearDown();40 34 } 41 35 -
trunk/tests/phpunit/tests/l10n/getUserLocale.php
r50456 r50463 22 22 23 23 public function tearDown() { 24 delete_user_meta( $this->user_id, 'locale' );25 24 set_current_screen( 'front' ); 26 25 -
trunk/tests/phpunit/tests/l10n/loadTextdomain.php
r50456 r50463 27 27 } 28 28 29 public function tearDown() {30 remove_filter( 'plugin_locale', array( $this, 'store_locale' ) );31 remove_filter( 'theme_locale', array( $this, 'store_locale' ) );32 33 parent::tearDown();34 }35 36 29 public function store_locale( $locale ) { 37 30 $this->locale = $locale; -
trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php
r50456 r50463 41 41 public function tearDown() { 42 42 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 43 remove_filter( 'theme_root', array( $this, 'filter_theme_root' ) );44 remove_filter( 'stylesheet_root', array( $this, 'filter_theme_root' ) );45 remove_filter( 'template_root', array( $this, 'filter_theme_root' ) );46 43 wp_clean_themes_cache(); 47 44 unset( $GLOBALS['wp_themes'] ); -
trunk/tests/phpunit/tests/multisite/getSpaceAllowed.php
r48937 r50463 11 11 protected $suppress = false; 12 12 13 protected static $original_site_blog_upload_space;14 protected static $original_blog_upload_space;15 16 public static function setUpBeforeClass() {17 parent::setUpBeforeClass();18 19 self::$original_site_blog_upload_space = get_site_option( 'blog_upload_space' );20 self::$original_blog_upload_space = get_option( 'blog_upload_space' );21 }22 23 13 public function setUp() { 24 14 global $wpdb; … … 29 19 public function tearDown() { 30 20 global $wpdb; 31 32 /**33 * Reset the two `blog_upload_space` options to their original values so34 * they can be relied on in other test classes.35 */36 update_site_option( 'blog_upload_space', self::$original_site_blog_upload_space );37 update_option( 'blog_upload_space', self::$original_blog_upload_space );38 21 39 22 $wpdb->suppress_errors( $this->suppress ); -
trunk/tests/phpunit/tests/multisite/isUploadSpaceAvailable.php
r46586 r50463 14 14 protected $suppress = false; 15 15 16 protected static $original_site_blog_upload_space;17 protected static $original_blog_upload_space;18 19 public static function setUpBeforeClass() {20 parent::setUpBeforeClass();21 22 self::$original_site_blog_upload_space = get_site_option( 'blog_upload_space' );23 self::$original_blog_upload_space = get_option( 'blog_upload_space' );24 }25 26 16 public function setUp() { 27 17 global $wpdb; … … 34 24 public function tearDown() { 35 25 global $wpdb; 36 37 /**38 * Reset the two `blog_upload_space` options to their original values so39 * they can be relied on in other test classes.40 */41 update_site_option( 'blog_upload_space', self::$original_site_blog_upload_space );42 update_option( 'blog_upload_space', self::$original_blog_upload_space );43 26 44 27 $wpdb->suppress_errors( $this->suppress ); -
trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php
r48937 r50463 27 27 global $wpdb; 28 28 29 update_site_option( 'ms_files_rewriting', 0 );30 29 $wpdb->suppress_errors( $this->suppress ); 31 30 -
trunk/tests/phpunit/tests/oembed/controller.php
r50450 r50463 65 65 $wp_rest_server = null; 66 66 67 remove_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10 );68 remove_filter( 'oembed_result', array( $this, 'filter_oembed_result' ), 10 );69 67 parent::tearDown(); 70 68 } -
trunk/tests/phpunit/tests/post/revisions.php
r49603 r50463 21 21 } 22 22 23 function tearDown() {24 unset( $GLOBALS['wp_post_types'][ $this->post_type ] );25 parent::tearDown();26 }27 28 23 /** 29 24 * Note: Test needs reviewing when #16215 is fixed because I'm not sure the test current tests the "correct" behavior -
trunk/tests/phpunit/tests/query/isTerm.php
r48937 r50463 66 66 } 67 67 68 function tearDown() {69 global $wp_rewrite;70 71 _unregister_taxonomy( 'testtax' );72 73 $wp_rewrite->init();74 75 remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );76 parent::tearDown();77 }78 79 68 function test_tag_action_tax() { 80 69 // Tag with taxonomy added. -
trunk/tests/phpunit/tests/query/search.php
r48939 r50463 18 18 19 19 function tearDown() { 20 _unregister_post_type( $this->post_type );21 20 unset( $this->q ); 22 21 -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r50450 r50463 95 95 unlink( $this->test_file2 ); 96 96 } 97 98 remove_action( 'rest_insert_attachment', array( $this, 'filter_rest_insert_attachment' ) );99 remove_action( 'rest_after_insert_attachment', array( $this, 'filter_rest_after_insert_attachment' ) );100 97 101 98 $this->remove_added_uploads(); -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r49922 r50463 1183 1183 } 1184 1184 1185 public function tearDown() {1186 _unregister_taxonomy( 'batman' );1187 _unregister_taxonomy( 'robin' );1188 parent::tearDown();1189 }1190 1191 1185 protected function check_get_taxonomy_terms_response( $response ) { 1192 1186 $this->assertSame( 200, $response->get_status() ); -
trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php
r50024 r50463 765 765 } 766 766 767 public function tearDown() {768 parent::tearDown();769 remove_filter( 'theme_page_templates', array( $this, 'filter_theme_page_templates' ) );770 }771 772 767 public function filter_theme_page_templates( $page_templates ) { 773 768 return array( -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r50284 r50463 5089 5089 5090 5090 public function tearDown() { 5091 _unregister_post_type( 'private-post' );5092 _unregister_post_type( 'youseeme' );5093 5091 if ( isset( $this->attachment_id ) ) { 5094 5092 $this->remove_added_uploads(); 5095 5093 } 5096 remove_filter( 'rest_pre_dispatch', array( $this, 'wpSetUpBeforeRequest' ), 10, 3 ); 5097 remove_filter( 'posts_clauses', array( $this, 'save_posts_clauses' ), 10, 2 ); 5094 5098 5095 parent::tearDown(); 5099 5096 } -
trunk/tests/phpunit/tests/rest-api/rest-revisions-controller.php
r49603 r50463 75 75 $this->revision_3 = array_pop( $revisions ); 76 76 $this->revision_id3 = $this->revision_3->ID; 77 }78 79 public function tearDown() {80 parent::tearDown();81 82 remove_filter( 'map_meta_cap', array( $this, '_filter_map_meta_cap_remove_no_allow_revisions' ) );83 77 } 84 78 -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r50450 r50463 32 32 $wp_rest_server = null; 33 33 34 remove_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );35 34 parent::tearDown(); 36 35 } -
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r49922 r50463 1401 1401 } 1402 1402 1403 public function tearDown() {1404 _unregister_taxonomy( 'batman' );1405 _unregister_taxonomy( 'robin' );1406 parent::tearDown();1407 }1408 1409 1403 protected function check_get_taxonomy_terms_response( $response ) { 1410 1404 $this->assertSame( 200, $response->get_status() ); -
trunk/tests/phpunit/tests/rewrite/numericSlugs.php
r48937 r50463 16 16 } 17 17 18 public function tearDown() {19 parent::tearDown();20 remove_filter( 'wp_unique_post_slug', array( $this, 'filter_unique_post_slug' ), 10, 6 );21 }22 23 18 public function test_go_to_year_segment_collision_without_title() { 24 19 global $wpdb; -
trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php
r50450 r50463 33 33 $this->old_slug_redirect_url = null; 34 34 35 remove_filter( 'old_slug_redirect_url', array( $this, 'filter_old_slug_redirect_url' ), 10 );36 35 parent::tearDown(); 37 36 } -
trunk/tests/phpunit/tests/rewrite/rewriteTags.php
r48939 r50463 8 8 protected $rewritereplace; 9 9 protected $queryreplace; 10 protected $wp_rewrite;11 10 12 11 public function setUp() { … … 14 13 parent::setUp(); 15 14 16 $this->wp_rewrite = $wp_rewrite; 17 $wp_rewrite = new WP_Rewrite(); 15 $wp_rewrite = new WP_Rewrite(); 18 16 $wp_rewrite->init(); 19 17 … … 21 19 $this->rewritereplace = $wp_rewrite->rewritereplace; 22 20 $this->queryreplace = $wp_rewrite->queryreplace; 23 }24 25 public function tearDown() {26 global $wp_rewrite;27 $wp_rewrite = $this->wp_rewrite;28 21 } 29 22 -
trunk/tests/phpunit/tests/theme/WPTheme.php
r48939 r50463 21 21 function tearDown() { 22 22 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 23 remove_filter( 'theme_root', array( $this, '_theme_root' ) );24 remove_filter( 'stylesheet_root', array( $this, '_theme_root' ) );25 remove_filter( 'template_root', array( $this, '_theme_root' ) );26 23 wp_clean_themes_cache(); 27 24 unset( $GLOBALS['wp_themes'] ); -
trunk/tests/phpunit/tests/theme/themeDir.php
r49566 r50463 27 27 function tearDown() { 28 28 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 29 remove_filter( 'theme_root', array( $this, '_theme_root' ) );30 remove_filter( 'stylesheet_root', array( $this, '_theme_root' ) );31 remove_filter( 'template_root', array( $this, '_theme_root' ) );32 29 wp_clean_themes_cache(); 33 30 unset( $GLOBALS['wp_themes'] ); -
trunk/tests/phpunit/tests/user/author.php
r49932 r50463 38 38 39 39 setup_postdata( get_post( self::$post_id ) ); 40 }41 42 function tearDown() {43 wp_reset_postdata();44 parent::tearDown();45 40 } 46 41 -
trunk/tests/phpunit/tests/user/countUserPosts.php
r49603 r50463 59 59 } 60 60 61 public function tearDown() {62 _unregister_post_type( 'wptests_pt' );63 parent::tearDown();64 }65 66 61 public function test_count_user_posts_post_type_should_default_to_post() { 67 62 $this->assertEquals( 4, count_user_posts( self::$user_id ) ); -
trunk/tests/phpunit/tests/user/wpSendUserRequest.php
r49603 r50463 77 77 */ 78 78 public function tearDown() { 79 delete_option( 'WPLANG' );80 79 reset_phpmailer_instance(); 81 80 -
trunk/tests/phpunit/tests/xmlrpc/wp/getPostType.php
r49184 r50463 22 22 ); 23 23 register_post_type( $this->cpt_name, $this->cpt_args ); 24 }25 26 function tearDown() {27 _unregister_post_type( $this->cpt_name );28 29 parent::tearDown();30 24 } 31 25 -
trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php
r48939 r50463 16 16 grant_super_admin( $this->administrator_id ); 17 17 } 18 }19 20 function tearDown() {21 if ( is_multisite() ) {22 revoke_super_admin( $this->administrator_id );23 }24 parent::tearDown();25 18 } 26 19
Note: See TracChangeset
for help on using the changeset viewer.