Changeset 45588
- Timestamp:
- 07/02/2019 04:43:01 AM (5 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r45486 r45588 707 707 // from all over the place (globals, GET, etc), which makes it tricky 708 708 // to run them more than once without very carefully clearing everything 709 $_GET = $_POST = array(); 709 $_GET = array(); 710 $_POST = array(); 710 711 foreach ( array( 'query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow', 'current_screen' ) as $v ) { 711 712 if ( isset( $GLOBALS[ $v ] ) ) { -
trunk/tests/phpunit/includes/bootstrap.php
r45445 r45588 72 72 define( 'REST_TESTS_IMPOSSIBLY_HIGH_NUMBER', 99999999 ); 73 73 74 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 74 $PHP_SELF = '/index.php'; 75 $GLOBALS['PHP_SELF'] = '/index.php'; 76 $_SERVER['PHP_SELF'] = '/index.php'; 75 77 76 78 // Should we run in multisite mode? -
trunk/tests/phpunit/includes/install.php
r42343 r45588 21 21 tests_reset__SERVER(); 22 22 23 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 23 $PHP_SELF = '/index.php'; 24 $GLOBALS['PHP_SELF'] = '/index.php'; 25 $_SERVER['PHP_SELF'] = '/index.php'; 24 26 25 27 tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter_exit' ); -
trunk/tests/phpunit/includes/phpunit7/speed-trap-listener.php
r44701 r45588 267 267 */ 268 268 protected function renderFooter() { 269 if ( $hidden = $this->getHiddenCount( $this->slow ) ) { 269 $hidden = $this->getHiddenCount( $this->slow ); 270 if ( $hidden ) { 270 271 echo sprintf( '...and there %s %s more above your threshold hidden from view', $hidden == 1 ? 'is' : 'are', $hidden ); 271 272 } -
trunk/tests/phpunit/includes/testcase-canonical.php
r44701 r45588 62 62 ) 63 63 ); 64 self::$post_ids[] = $post_id= $factory->post->create(64 $post_id = $factory->post->create( 65 65 array( 66 66 'post_title' => 'post-format-test-gallery', … … 68 68 ) 69 69 ); 70 self::$post_ids[] = $factory->post->create( 70 self::$post_ids[] = $post_id; 71 $factory->post->create( 71 72 array( 72 73 'import_id' => 611, … … 76 77 ) 77 78 ); 79 self::$post_ids[] = $post_id; 78 80 79 81 self::$post_ids[] = $factory->post->create( … … 85 87 ); 86 88 87 self::$post_ids[] = $post_id= $factory->post->create(89 $post_id = $factory->post->create( 88 90 array( 89 91 'import_id' => 149, … … 92 94 ) 93 95 ); 96 self::$post_ids[] = $post_id; 94 97 self::$comment_ids = $factory->comment->create_post_comments( $post_id, 15 ); 95 98 … … 112 115 ) 113 116 ); 114 self::$post_ids[] = $post_id= $factory->post->create(117 $post_id = $factory->post->create( 115 118 array( 116 119 'post_type' => 'page', … … 118 121 ) 119 122 ); 123 self::$post_ids[] = $post_id; 120 124 self::$post_ids[] = $factory->post->create( 121 125 array( … … 127 131 ); 128 132 129 self::$post_ids[] = $parent_id= $factory->post->create(133 $parent_id = $factory->post->create( 130 134 array( 131 135 'post_name' => 'parent', … … 133 137 ) 134 138 ); 135 self::$post_ids[] = $child_id_1 = $factory->post->create( 139 self::$post_ids[] = $parent_id; 140 $child_id_1 = $factory->post->create( 136 141 array( 137 142 'post_name' => 'child1', … … 140 145 ) 141 146 ); 142 self::$post_ids[] = $child_id_2 = $factory->post->create( 147 self::$post_ids[] = $child_id_1; 148 $child_id_2 = $factory->post->create( 143 149 array( 144 150 'post_name' => 'child2', … … 147 153 ) 148 154 ); 149 self::$post_ids[] = $grandchild_id_1 = $factory->post->create( 155 self::$post_ids[] = $child_id_2; 156 $grandchild_id_1 = $factory->post->create( 150 157 array( 151 158 'post_name' => 'grandchild', … … 154 161 ) 155 162 ); 156 self::$post_ids[] = $grandchild_id_2 = $factory->post->create( 163 self::$post_ids[] = $grandchild_id_1; 164 $grandchild_id_2 = $factory->post->create( 157 165 array( 158 166 'post_name' => 'grandchild', … … 161 169 ) 162 170 ); 171 self::$post_ids[] = $grandchild_id_2; 163 172 164 173 $cat1 = $factory->term->create( -
trunk/tests/phpunit/tests/admin/includesPlugin.php
r42343 r45588 407 407 408 408 $files_to_move = array(); 409 if ( $mu_plugins = opendir( WPMU_PLUGIN_DIR ) ) { 409 $mu_plugins = opendir( WPMU_PLUGIN_DIR ); 410 if ( $mu_plugins ) { 410 411 while ( false !== $plugin = readdir( $mu_plugins ) ) { 411 412 if ( 0 !== strpos( $plugin, '.' ) ) { … … 433 434 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup'; 434 435 $files_to_move = array(); 435 if ( is_dir( $mu_bu_dir ) && $mu_plugins = opendir( $mu_bu_dir ) ) { 436 $mu_plugins = @opendir( $mu_bu_dir ); 437 if ( $mu_plugins ) { 436 438 while ( false !== $plugin = readdir( $mu_plugins ) ) { 437 439 if ( 0 !== strpos( $plugin, '.' ) ) { -
trunk/tests/phpunit/tests/admin/includesPost.php
r45424 r45588 14 14 15 15 public static function wpSetUpBeforeClass( $factory ) { 16 self::$user_ids = self::$author_ids = $factory->user->create_many( 2, array( 'role' => 'author' ) ); 17 18 self::$user_ids[] = self::$contributor_id = $factory->user->create( array( 'role' => 'contributor' ) ); 19 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 20 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 16 self::$user_ids = $factory->user->create_many( 2, array( 'role' => 'author' ) ); 17 self::$author_ids = self::$user_ids; 18 19 self::$contributor_id = $factory->user->create( array( 'role' => 'contributor' ) ); 20 self::$user_ids[] = self::$contributor_id; 21 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 22 self::$user_ids[] = self::$editor_id; 23 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 24 self::$user_ids[] = self::$admin_id; 21 25 22 26 self::$post_id = $factory->post->create(); -
trunk/tests/phpunit/tests/admin/includesScreen.php
r45224 r45588 172 172 173 173 foreach ( $this->core_screens as $hook_name => $screen ) { 174 $_GET = $_POST = $_REQUEST = array(); 175 $GLOBALS['taxnow'] = $GLOBALS['typenow'] = ''; 176 $screen = (object) $screen; 177 $hook = parse_url( $hook_name ); 174 $_GET = array(); 175 $_POST = array(); 176 $_REQUEST = array(); 177 $GLOBALS['taxnow'] = ''; 178 $GLOBALS['typenow'] = ''; 179 $screen = (object) $screen; 180 $hook = parse_url( $hook_name ); 178 181 179 182 if ( ! empty( $hook['query'] ) ) { 180 183 $args = wp_parse_args( $hook['query'] ); 181 184 if ( isset( $args['taxonomy'] ) ) { 182 $GLOBALS['taxnow'] = $_GET['taxonomy'] = $_POST['taxonomy'] = $_REQUEST['taxonomy'] = $args['taxonomy']; 185 $GLOBALS['taxnow'] = $args['taxonomy']; 186 $_GET['taxonomy'] = $args['taxonomy']; 187 $_POST['taxonomy'] = $args['taxonomy']; 188 $_REQUEST['taxonomy'] = $args['taxonomy']; 183 189 } 184 190 if ( isset( $args['post_type'] ) ) { 185 $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $args['post_type']; 191 $GLOBALS['typenow'] = $args['post_type']; 192 $_GET['post_type'] = $args['post_type']; 193 $_POST['post_type'] = $args['post_type']; 194 $_REQUEST['post_type'] = $args['post_type']; 186 195 } elseif ( isset( $screen->post_type ) ) { 187 $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen->post_type; 196 $GLOBALS['typenow'] = $screen->post_type; 197 $_GET['post_type'] = $screen->post_type; 198 $_POST['post_type'] = $screen->post_type; 199 $_REQUEST['post_type'] = $screen->post_type; 188 200 } 189 201 } … … 485 497 register_post_type( 'type_shows_in_rest', array( 'show_in_rest' => true ) ); 486 498 487 $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = 'type_shows_in_rest'; 499 $GLOBALS['typenow'] = 'type_shows_in_rest'; 500 $_GET['post_type'] = 'type_shows_in_rest'; 501 $_POST['post_type'] = 'type_shows_in_rest'; 502 $_REQUEST['post_type'] = 'type_shows_in_rest'; 488 503 $GLOBALS['hook_suffix'] = $hook; 489 504 -
trunk/tests/phpunit/tests/adminbar.php
r43571 r45588 22 22 23 23 public static function wpSetUpBeforeClass( $factory ) { 24 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 25 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 26 self::$user_ids[] = self::$no_role_id = $factory->user->create( array( 'role' => '' ) ); 24 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 25 self::$user_ids[] = self::$editor_id; 26 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 27 self::$user_ids[] = self::$admin_id; 28 self::$no_role_id = $factory->user->create( array( 'role' => '' ) ); 29 self::$user_ids[] = self::$no_role_id; 27 30 } 28 31 -
trunk/tests/phpunit/tests/ajax/Autosave.php
r42343 r45588 30 30 31 31 public static function wpSetUpBeforeClass( $factory ) { 32 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 33 self::$user_ids[] = self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 32 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 33 self::$user_ids[] = self::$admin_id; 34 self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) ); 35 self::$user_ids[] = self::$editor_id; 34 36 35 37 self::$post_id = $factory->post->create( array( 'post_status' => 'draft' ) ); -
trunk/tests/phpunit/tests/ajax/CustomizeManager.php
r42863 r45588 120 120 // Unauthorized. 121 121 wp_set_current_user( self::$subscriber_user_id ); 122 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 123 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 124 $exception = null; 122 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 123 $_POST['nonce'] = $nonce; 124 $_GET['nonce'] = $nonce; 125 $_REQUEST['nonce'] = $nonce; 126 $exception = null; 125 127 try { 126 128 ob_start(); … … 134 136 // Not called setup_theme. 135 137 wp_set_current_user( self::$admin_user_id ); 136 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 137 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 138 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 139 $_POST['nonce'] = $nonce; 140 $_GET['nonce'] = $nonce; 141 $_REQUEST['nonce'] = $nonce; 138 142 $this->make_ajax_call( 'customize_save' ); 139 143 $this->assertFalse( $this->_last_response_parsed['success'] ); … … 141 145 142 146 // Bad nonce. 143 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = 'bad'; 147 $_POST['nonce'] = 'bad'; 148 $_GET['nonce'] = 'bad'; 149 $_REQUEST['nonce'] = 'bad'; 144 150 $wp_customize->setup_theme(); 145 151 $this->make_ajax_call( 'customize_save' ); … … 149 155 // User cannot create. 150 156 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 151 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 157 $_POST['nonce'] = $nonce; 158 $_GET['nonce'] = $nonce; 159 $_REQUEST['nonce'] = $nonce; 152 160 $post_type_obj = get_post_type_object( 'customize_changeset' ); 153 161 $post_type_obj->cap->create_posts = 'create_customize_changesets'; … … 251 259 ); 252 260 $wp_customize->register_controls(); 253 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 254 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 261 $nonce = wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ); 262 $_POST['nonce'] = $nonce; 263 $_GET['nonce'] = $nonce; 264 $_REQUEST['nonce'] = $nonce; 255 265 $wp_customize->setup_theme(); 256 266 return $wp_customize; … … 483 493 $this->assertEquals( 'invalid_nonce', $this->_last_response_parsed['data']['code'] ); 484 494 485 $nonce = wp_create_nonce( 'trash_customize_changeset' ); 486 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 495 $nonce = wp_create_nonce( 'trash_customize_changeset' ); 496 $_POST['nonce'] = $nonce; 497 $_GET['nonce'] = $nonce; 498 $_REQUEST['nonce'] = $nonce; 487 499 $this->make_ajax_call( 'customize_trash' ); 488 500 $this->assertFalse( $this->_last_response_parsed['success'] ); … … 568 580 $this->assertEquals( 'invalid_nonce', $this->_last_response_parsed['data'] ); 569 581 570 $nonce = wp_create_nonce( 'customize_dismiss_autosave_or_lock' ); 571 $_POST['nonce'] = $_GET['nonce'] = $_REQUEST['nonce'] = $nonce; 572 573 $_POST['dismiss_lock'] = $_GET['dismiss_lock'] = $_REQUEST['dismiss_lock'] = true; 582 $nonce = wp_create_nonce( 'customize_dismiss_autosave_or_lock' ); 583 $_POST['nonce'] = $nonce; 584 $_GET['nonce'] = $nonce; 585 $_REQUEST['nonce'] = $nonce; 586 587 $_POST['dismiss_lock'] = true; 588 $_GET['dismiss_lock'] = true; 589 $_REQUEST['dismiss_lock'] = true; 574 590 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 575 591 $this->assertFalse( $this->_last_response_parsed['success'] ); 576 592 $this->assertEquals( 'no_changeset_to_dismiss_lock', $this->_last_response_parsed['data'] ); 577 593 578 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true; 594 $_POST['dismiss_autosave'] = true; 595 $_GET['dismiss_autosave'] = true; 596 $_REQUEST['dismiss_autosave'] = true; 579 597 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 580 598 $this->assertFalse( $this->_last_response_parsed['success'] ); … … 640 658 ); 641 659 642 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = false; 660 $_POST['dismiss_autosave'] = false; 661 $_GET['dismiss_autosave'] = false; 662 $_REQUEST['dismiss_autosave'] = false; 643 663 $this->make_ajax_call( 'customize_dismiss_autosave_or_lock' ); 644 664 $this->assertTrue( $this->_last_response_parsed['success'] ); 645 665 $this->assertEquals( 'changeset_lock_dismissed', $this->_last_response_parsed['data'] ); 646 666 647 $_POST['dismiss_autosave'] = $_GET['dismiss_autosave'] = $_REQUEST['dismiss_autosave'] = true; 667 $_POST['dismiss_autosave'] = true; 668 $_GET['dismiss_autosave'] = true; 669 $_REQUEST['dismiss_autosave'] = true; 648 670 $this->assertNotWPError( $r ); 649 671 $this->assertFalse( wp_get_post_autosave( $wp_customize->changeset_post_id() ) ); -
trunk/tests/phpunit/tests/comment/getCommentAuthorUrlLink.php
r42343 r45588 32 32 33 33 public function test_global_comment() { 34 $GLOBALS['comment'] = $comment = reset( self::$comments ); 34 $comment = reset( self::$comments ); 35 $GLOBALS['comment'] = $comment; 35 36 36 37 $url_link = get_comment_author_url_link(); -
trunk/tests/phpunit/tests/comment/getPageOfComment.php
r45424 r45588 258 258 259 259 $now = time(); 260 $comments_0 = $comments_1 = array(); 260 $comments_0 = array(); 261 $comments_1 = array(); 261 262 for ( $i = 0; $i < 5; $i++ ) { 262 263 $comments_0[] = self::factory()->comment->create( … … 287 288 $post = self::factory()->post->create(); 288 289 289 $now = time(); 290 $comment_parents = $comment_children = array(); 290 $now = time(); 291 $comment_parents = array(); 292 $comment_children = array(); 291 293 for ( $i = 0; $i < 5; $i++ ) { 292 294 $parent = self::factory()->comment->create( -
trunk/tests/phpunit/tests/customize/manager.php
r44582 r45588 937 937 $uuid = wp_generate_uuid4(); 938 938 939 $ wp_customize = $manager= new WP_Customize_Manager(939 $manager = new WP_Customize_Manager( 940 940 array( 941 941 'changeset_uuid' => $uuid, … … 1040 1040 1041 1041 // Attempt a non-transactional/incremental update. 1042 $ wp_customize = $manager= new WP_Customize_Manager(1042 $manager = new WP_Customize_Manager( 1043 1043 array( 1044 1044 'changeset_uuid' => $uuid, … … 1101 1101 } 1102 1102 1103 $wp_customize = $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 1103 $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 1104 $wp_customize = $manager; 1104 1105 do_action( 'customize_register', $wp_customize ); 1105 1106 $manager->add_setting( … … 1143 1144 add_post_type_support( 'customize_changeset', 'revisions' ); 1144 1145 $uuid = wp_generate_uuid4(); 1145 $wp_customize = $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 1146 $manager = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 1147 $wp_customize = $manager; 1146 1148 do_action( 'customize_register', $manager ); 1147 1149 -
trunk/tests/phpunit/tests/customize/section.php
r43571 r45588 11 11 12 12 public static function wpSetUpBeforeClass( $factory ) { 13 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 13 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 14 self::$user_ids[] = self::$admin_id; 14 15 } 15 16 -
trunk/tests/phpunit/tests/db/charset.php
r42343 r45588 455 455 456 456 // The data above is easy to edit. Now, prepare it for the data provider. 457 $data_provider = $multiple = $multiple_expected = array(); 457 $data_provider = array(); 458 $multiple = array(); 459 $multiple_expected = array(); 458 460 foreach ( $fields as $test_case => $field ) { 459 461 $expected = $field; … … 583 585 unset( $vars['charset'] ); 584 586 foreach ( $vars as $var_name => $var ) { 585 $data = $expected = $var; 587 $data = $var; 588 $expected = $var; 586 589 foreach ( $data as &$datum ) { 587 590 // 'charset' and 'ascii' are part of the expected return only. -
trunk/tests/phpunit/tests/formatting/Autop.php
r45585 r45588 416 416 ); 417 417 418 $content = $expected = array(); 418 $content = array(); 419 $expected = array(); 419 420 420 421 foreach ( $inlines as $inline ) { … … 544 545 */ 545 546 function test_that_wpautop_doses_not_add_extra_closing_p_in_figure() { 546 $content1 = $expected1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>'; 547 $content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>'; 548 $expected1 = $content1; 547 549 548 550 $content2 = '<figure> -
trunk/tests/phpunit/tests/formatting/SanitizeTextField.php
r44731 r45588 134 134 $expected_multiline = $expected['multiline']; 135 135 } else { 136 $expected_oneline = $expected_multiline = $expected; 136 $expected_oneline = $expected; 137 $expected_multiline = $expected; 137 138 } 138 139 $this->assertEquals( $expected_oneline, sanitize_text_field( $string ) ); -
trunk/tests/phpunit/tests/formatting/date.php
r42343 r45588 14 14 function test_get_date_from_gmt_outside_of_dst() { 15 15 update_option( 'timezone_string', 'Europe/London' ); 16 $gmt = $local = '2012-01-01 12:34:56'; 16 $local = '2012-01-01 12:34:56'; 17 $gmt = $local; 17 18 $this->assertEquals( $local, get_date_from_gmt( $gmt ) ); 18 19 } … … 35 36 function test_get_gmt_from_date_outside_of_dst() { 36 37 update_option( 'timezone_string', 'Europe/London' ); 37 $local = $gmt = '2012-01-01 12:34:56'; 38 $local = '2012-01-01 12:34:56'; 39 $gmt = $local; 38 40 $this->assertEquals( $gmt, get_gmt_from_date( $local ) ); 39 41 } … … 53 55 */ 54 56 function test_get_date_and_time_from_gmt_no_timezone() { 55 $gmt = $local = '2012-01-01 12:34:56'; 57 $local = '2012-01-01 12:34:56'; 58 $gmt = $local; 56 59 $this->assertEquals( $gmt, get_date_from_gmt( $local ) ); 57 60 } -
trunk/tests/phpunit/tests/functions.php
r45378 r45588 843 843 } 844 844 845 $old_charsets = $charsets = mb_detect_order(); 845 $charsets = mb_detect_order(); 846 $old_charsets = $charsets; 846 847 if ( ! in_array( 'EUC-JP', $charsets ) ) { 847 848 $charsets[] = 'EUC-JP'; … … 867 868 } 868 869 869 $old_charsets = $charsets = mb_detect_order(); 870 $charsets = mb_detect_order(); 871 $old_charsets = $charsets; 870 872 if ( ! in_array( 'EUC-JP', $charsets ) ) { 871 873 $charsets[] = 'EUC-JP'; -
trunk/tests/phpunit/tests/general/archives.php
r42343 r45588 31 31 ); 32 32 $this->assertInternalType( 'string', $result ); 33 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) ); 33 $time1 = wp_cache_get( 'last_changed', 'posts' ); 34 $this->assertNotEmpty( $time1 ); 34 35 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 35 36 -
trunk/tests/phpunit/tests/import/base.php
r42343 r45588 28 28 $this->assertTrue( is_file( $file ), 'Import file is not a file.' ); 29 29 30 $authors = $mapping = $new = array(); 30 $authors = array(); 31 $mapping = array(); 32 $new = array(); 31 33 $i = 0; 32 34 -
trunk/tests/phpunit/tests/kses.php
r45363 r45588 55 55 $expected_attr = "$name='" . trim( $value, ';' ) . "'"; 56 56 } else { 57 $attr = $expected_attr = $name; 57 $attr = $name; 58 $expected_attr = $name; 58 59 } 59 60 $string = "<a $attr>I link this</a>"; -
trunk/tests/phpunit/tests/menu/nav-menu.php
r44167 r45588 55 55 function test_filter_registered_locations() { 56 56 $this->register_nav_menu_locations( array( 'primary', 'secondary' ) ); 57 $ old_next_theme_nav_menu_locations = $prev_theme_nav_menu_locations= array(57 $prev_theme_nav_menu_locations = array( 58 58 'primary' => 1, 59 59 'secondary' => 2, 60 60 'social' => 3, 61 61 ); 62 $old_next_theme_nav_menu_locations = $prev_theme_nav_menu_locations; 62 63 $new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $prev_theme_nav_menu_locations ); 63 64 -
trunk/tests/phpunit/tests/option/wpLoadAllOptions.php
r42343 r45588 105 105 106 106 function return_pre_cache_filter( $alloptions ) { 107 return $this->alloptions = $alloptions; 107 $this->alloptions = $alloptions; 108 return $this->alloptions; 108 109 } 109 110 } -
trunk/tests/phpunit/tests/post.php
r44454 r45588 49 49 global $current_user, $user_ID; 50 50 51 $current_user = $user_ID = null; 51 $current_user = null; 52 $user_ID = null; 52 53 } 53 54 … … 125 126 126 127 // insert a post and make sure the ID is ok 127 $id = $this->post_ids[] = wp_insert_post( $post ); 128 $id = wp_insert_post( $post ); 129 $this->post_ids[] = $id; 128 130 #dmp(_get_cron_array()); 129 131 $this->assertTrue( is_numeric( $id ) ); … … 159 161 160 162 // insert a post and make sure the ID is ok 161 $id = $this->post_ids[] = wp_insert_post( $post ); 163 $id = wp_insert_post( $post ); 164 $this->post_ids[] = $id; 162 165 163 166 // fetch the post and make sure has the correct date and status … … 201 204 202 205 // insert a post and make sure the ID is ok 203 $id = $this->post_ids[] = wp_insert_post( $post ); 206 $id = wp_insert_post( $post ); 207 $this->post_ids[] = $id; 204 208 205 209 // fetch the post and make sure has the correct date and status … … 241 245 242 246 // insert a post and make sure the ID is ok 243 $id = $this->post_ids[] = wp_insert_post( $post ); 247 $id = wp_insert_post( $post ); 248 $this->post_ids[] = $id; 244 249 #dmp(_get_cron_array()); 245 250 $this->assertTrue( is_numeric( $id ) ); … … 273 278 274 279 // insert a post and make sure the ID is ok 275 $id = $this->post_ids[] = wp_insert_post( $post ); 280 $id = wp_insert_post( $post ); 281 $this->post_ids[] = $id; 276 282 277 283 // fetch the post and make sure has the correct date and status … … 314 320 315 321 // insert a post and make sure the ID is ok 316 $id = $this->post_ids[] = wp_insert_post( $post ); 322 $id = wp_insert_post( $post ); 323 $this->post_ids[] = $id; 317 324 318 325 // fetch the post and make sure has the correct date and status … … 354 361 355 362 // insert a post and make sure the ID is ok 356 $id = $this->post_ids[] = wp_insert_post( $post ); 363 $id = wp_insert_post( $post ); 364 $this->post_ids[] = $id; 357 365 #dmp(_get_cron_array()); 358 366 $this->assertTrue( is_numeric( $id ) ); … … 408 416 409 417 // insert a post and make sure the ID is ok 410 $id = $this->post_ids[] = wp_insert_post( $post ); 418 $id = wp_insert_post( $post ); 419 $this->post_ids[] = $id; 411 420 412 421 // fetch the post and make sure has the correct date and status … … 512 521 513 522 // insert a post and make sure the ID is ok 514 $id = $this->post_ids[] = wp_insert_post( $post ); 523 $id = wp_insert_post( $post ); 524 $this->post_ids[] = $id; 515 525 516 526 // check that there's a publish_future_post job scheduled at the right time … … 541 551 542 552 // insert a post and make sure the ID is ok 543 $id = $this->post_ids[] = wp_insert_post( $post ); 553 $id = wp_insert_post( $post ); 554 $this->post_ids[] = $id; 544 555 545 556 $plink = get_permalink( $id ); -
trunk/tests/phpunit/tests/post/getPages.php
r44587 r45588 22 22 $pages = get_pages(); 23 23 $this->assertEquals( 3, count( $pages ) ); 24 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) ); 25 $num_queries = $wpdb->num_queries; 24 $time1 = wp_cache_get( 'last_changed', 'posts' ); 25 $this->assertNotEmpty( $time1 ); 26 $num_queries = $wpdb->num_queries; 26 27 foreach ( $pages as $page ) { 27 28 $this->assertInstanceOf( 'WP_Post', $page ); -
trunk/tests/phpunit/tests/post/wpUniquePostSlug.php
r42343 r45588 32 32 ); 33 33 34 $id = $this->post_ids[] = self::factory()->post->create( $post ); 34 $id = self::factory()->post->create( $post ); 35 $this->post_ids[] = $id; 35 36 } 36 37 -
trunk/tests/phpunit/tests/query/conditionals.php
r44968 r45588 162 162 function test_page_trackback() { 163 163 $page_ids = array(); 164 $page_id s[] = $page_id= self::factory()->post->create(164 $page_id = self::factory()->post->create( 165 165 array( 166 166 'post_type' => 'page', … … 168 168 ) 169 169 ); 170 $page_ids[] = $page_id = self::factory()->post->create( 170 $page_ids[] = $page_id; 171 $page_id = self::factory()->post->create( 171 172 array( 172 173 'post_type' => 'page', … … 175 176 ) 176 177 ); 177 $page_ids[] = $page_id = self::factory()->post->create( 178 $page_ids[] = $page_id; 179 $page_ids[] = self::factory()->post->create( 178 180 array( 179 181 'post_type' => 'page', … … 198 200 function test_page_feed() { 199 201 $page_ids = array(); 200 $page_id s[] = $page_id= self::factory()->post->create(202 $page_id = self::factory()->post->create( 201 203 array( 202 204 'post_type' => 'page', … … 204 206 ) 205 207 ); 206 $page_ids[] = $page_id = self::factory()->post->create( 208 $page_ids[] = $page_id; 209 $page_id = self::factory()->post->create( 207 210 array( 208 211 'post_type' => 'page', … … 211 214 ) 212 215 ); 213 $page_ids[] = $page_id = self::factory()->post->create( 216 $page_ids[] = $page_id; 217 $page_ids[] = self::factory()->post->create( 214 218 array( 215 219 'post_type' => 'page', … … 234 238 function test_page_feed_with_no_comments() { 235 239 $page_ids = array(); 236 $page_id s[] = $page_id= self::factory()->post->create(240 $page_id = self::factory()->post->create( 237 241 array( 238 242 'post_type' => 'page', … … 240 244 ) 241 245 ); 242 $page_ids[] = $page_id = self::factory()->post->create( 246 $page_ids[] = $page_id; 247 $page_id = self::factory()->post->create( 243 248 array( 244 249 'post_type' => 'page', … … 247 252 ) 248 253 ); 249 $page_ids[] = $page_id = self::factory()->post->create( 254 $page_ids[] = $page_id; 255 $page_ids[] = self::factory()->post->create( 250 256 array( 251 257 'post_type' => 'page', … … 270 276 function test_page_feed_atom() { 271 277 $page_ids = array(); 272 $page_id s[] = $page_id= self::factory()->post->create(278 $page_id = self::factory()->post->create( 273 279 array( 274 280 'post_type' => 'page', … … 276 282 ) 277 283 ); 278 $page_ids[] = $page_id = self::factory()->post->create( 284 $page_ids[] = $page_id; 285 $page_id = self::factory()->post->create( 279 286 array( 280 287 'post_type' => 'page', … … 283 290 ) 284 291 ); 285 $page_ids[] = $page_id = self::factory()->post->create( 292 $page_ids[] = $page_id; 293 $page_ids[] = self::factory()->post->create( 286 294 array( 287 295 'post_type' => 'page', -
trunk/tests/phpunit/tests/query/results.php
r43571 r45588 23 23 24 24 public static function wpSetUpBeforeClass( $factory ) { 25 self::$cat_ids[] = $cat_a= $factory->term->create(25 $cat_a = $factory->term->create( 26 26 array( 27 27 'taxonomy' => 'category', … … 29 29 ) 30 30 ); 31 self::$cat_ids[] = $cat_b = $factory->term->create( 31 self::$cat_ids[] = $cat_a; 32 $cat_b = $factory->term->create( 32 33 array( 33 34 'taxonomy' => 'category', … … 35 36 ) 36 37 ); 37 self::$cat_ids[] = $cat_c = $factory->term->create( 38 self::$cat_ids[] = $cat_b; 39 $cat_c = $factory->term->create( 38 40 array( 39 41 'taxonomy' => 'category', … … 41 43 ) 42 44 ); 43 44 self::$tag_ids[] = $tag_a = $factory->term->create( 45 self::$cat_ids[] = $cat_c; 46 47 $tag_a = $factory->term->create( 45 48 array( 46 49 'taxonomy' => 'post_tag', … … 48 51 ) 49 52 ); 50 self::$tag_ids[] = $tag_b = $factory->term->create( 53 self::$tag_ids[] = $tag_a; 54 $tag_b = $factory->term->create( 51 55 array( 52 56 'taxonomy' => 'post_tag', … … 54 58 ) 55 59 ); 56 self::$tag_ids[] = $tag_c = $factory->term->create( 60 self::$tag_ids[] = $tag_b; 61 $tag_c = $factory->term->create( 57 62 array( 58 63 'taxonomy' => 'post_tag', … … 60 65 ) 61 66 ); 62 self::$tag_ids[] = $tag_nun = $factory->term->create( 67 self::$tag_ids[] = $tag_c; 68 $tag_nun = $factory->term->create( 63 69 array( 64 70 'taxonomy' => 'post_tag', … … 66 72 ) 67 73 ); 74 self::$tag_ids[] = $tag_nun; 68 75 69 76 self::$post_ids[] = $factory->post->create( … … 233 240 ); 234 241 235 self::$p ost_ids[] = self::$parent_one= $factory->post->create(242 self::$parent_one = $factory->post->create( 236 243 array( 237 244 'post_title' => 'parent-one', … … 239 246 ) 240 247 ); 241 self::$post_ids[] = self::$parent_two = $factory->post->create( 248 self::$post_ids[] = self::$parent_one; 249 self::$parent_two = $factory->post->create( 242 250 array( 243 251 'post_title' => 'parent-two', … … 245 253 ) 246 254 ); 247 self::$post_ids[] = self::$parent_three = $factory->post->create( 255 self::$post_ids[] = self::$parent_two; 256 self::$parent_three = $factory->post->create( 248 257 array( 249 258 'post_title' => 'parent-three', … … 251 260 ) 252 261 ); 253 self::$post_ids[] = self::$child_one = $factory->post->create( 262 self::$post_ids[] = self::$parent_three; 263 self::$child_one = $factory->post->create( 254 264 array( 255 265 'post_title' => 'child-one', … … 258 268 ) 259 269 ); 260 self::$post_ids[] = self::$child_two = $factory->post->create( 270 self::$post_ids[] = self::$child_one; 271 self::$child_two = $factory->post->create( 261 272 array( 262 273 'post_title' => 'child-two', … … 265 276 ) 266 277 ); 267 self::$post_ids[] = self::$child_three = $factory->post->create( 278 self::$post_ids[] = self::$child_two; 279 self::$child_three = $factory->post->create( 268 280 array( 269 281 'post_title' => 'child-three', … … 272 284 ) 273 285 ); 274 self::$post_ids[] = self::$child_four = $factory->post->create( 286 self::$post_ids[] = self::$child_three; 287 self::$child_four = $factory->post->create( 275 288 array( 276 289 'post_title' => 'child-four', … … 279 292 ) 280 293 ); 294 self::$post_ids[] = self::$child_four; 281 295 } 282 296 -
trunk/tests/phpunit/tests/query/setupPostdata.php
r45285 r45588 404 404 function test_setup_postdata_loop() { 405 405 $post_id = self::factory()->post->create( array( 'post_content' => 'global post' ) ); 406 $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id ); 406 $GLOBALS['post'] = get_post( $post_id ); 407 $GLOBALS['wp_query']->post = $GLOBALS['post']; 407 408 408 409 $ids = self::factory()->post->create_many( 5 ); -
trunk/tests/phpunit/tests/query/taxQuery.php
r43571 r45588 1299 1299 $posts = self::factory()->post->create_many( 5 ); 1300 1300 1301 $cats = $tags = array(); 1301 $cats = array(); 1302 $tags = array(); 1302 1303 1303 1304 // need term_taxonomy_ids in addition to term_ids, so no factory -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r45424 r45588 1379 1379 $this->assertEquals( $attachments_url, $links['https://api.w.org/attachment'][0]['href'] ); 1380 1380 1381 $term_links = $links['https://api.w.org/term']; 1382 $tag_link = $cat_link = $format_link = null; 1381 $term_links = $links['https://api.w.org/term']; 1382 $tag_link = null; 1383 $cat_link = null; 1384 $format_link = null; 1383 1385 foreach ( $term_links as $link ) { 1384 1386 if ( 'post_tag' === $link['attributes']['taxonomy'] ) { -
trunk/tests/phpunit/tests/user.php
r44645 r45588 19 19 20 20 public static function wpSetUpBeforeClass( $factory ) { 21 self::$ user_ids[] = self::$contrib_id = $factory->user->create(21 self::$contrib_id = $factory->user->create( 22 22 array( 23 23 'user_login' => 'user1', … … 34 34 ) 35 35 ); 36 37 self::$user_ids[] = self::$author_id = $factory->user->create( 36 self::$user_ids[] = self::$contrib_id; 37 38 self::$author_id = $factory->user->create( 38 39 array( 39 40 'user_login' => 'author_login', … … 42 43 ) 43 44 ); 44 45 self::$user_ids[] = self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 46 self::$user_ids[] = self::$editor_id = $factory->user->create( 45 self::$user_ids[] = self::$author_id; 46 47 self::$admin_id = $factory->user->create( array( 'role' => 'administrator' ) ); 48 self::$user_ids[] = self::$admin_id; 49 self::$editor_id = $factory->user->create( 47 50 array( 48 51 'role' => 'editor', … … 50 53 ) 51 54 ); 52 self::$user_ids[] = self::$sub_id = $factory->user->create( array( 'role' => 'subscriber' ) ); 55 self::$user_ids[] = self::$editor_id; 56 self::$sub_id = $factory->user->create( array( 'role' => 'subscriber' ) ); 57 self::$user_ids[] = self::$sub_id; 53 58 54 59 self::$_author = get_user_by( 'ID', self::$author_id ); … … 1375 1380 */ 1376 1381 function test_edit_user_blank_pw() { 1377 $_POST = $_GET = $_REQUEST = array(); 1382 $_POST = array(); 1383 $_GET = array(); 1384 $_REQUEST = array(); 1378 1385 $_POST['role'] = 'subscriber'; 1379 1386 $_POST['email'] = 'user1@example.com'; … … 1391 1398 1392 1399 // Check new user with password set. 1393 $_POST['pass1'] = $_POST['pass2'] = 'password'; 1400 $_POST['pass1'] = 'password'; 1401 $_POST['pass2'] = 'password'; 1394 1402 1395 1403 $user_id = edit_user(); … … 1402 1410 // Check updating user with empty password. 1403 1411 $_POST['nickname'] = 'nickname_updated'; 1404 $_POST['pass1'] = $_POST['pass2'] = ''; 1412 $_POST['pass1'] = ''; 1413 $_POST['pass2'] = ''; 1405 1414 1406 1415 $user_id = edit_user( $user_id ); … … 1551 1560 */ 1552 1561 function test_edit_user_role_update() { 1553 $_POST = $_GET = $_REQUEST = array(); 1562 $_POST = array(); 1563 $_GET = array(); 1564 $_REQUEST = array(); 1554 1565 1555 1566 $administrator = self::factory()->user->create( -
trunk/tests/phpunit/tests/user/slashes.php
r42343 r45588 28 28 */ 29 29 function test_add_user() { 30 $_POST = $_GET = $_REQUEST = array(); 30 $_POST = array(); 31 $_GET = array(); 32 $_REQUEST = array(); 31 33 $_POST['user_login'] = 'slash_example_user_1'; 32 34 $_POST['pass1'] = 'password'; … … 50 52 $this->assertEquals( $this->slash_3, $user->description ); 51 53 52 $_POST = $_GET = $_REQUEST = array(); 54 $_POST = array(); 55 $_GET = array(); 56 $_REQUEST = array(); 53 57 $_POST['user_login'] = 'slash_example_user_2'; 54 58 $_POST['pass1'] = 'password'; … … 79 83 $id = self::factory()->user->create(); 80 84 81 $_POST = $_GET = $_REQUEST = array(); 85 $_POST = array(); 86 $_GET = array(); 87 $_REQUEST = array(); 82 88 $_POST['role'] = 'subscriber'; 83 89 $_POST['email'] = 'user1@example.com'; … … 98 104 $this->assertEquals( $this->slash_3, $user->description ); 99 105 100 $_POST = $_GET = $_REQUEST = array(); 106 $_POST = array(); 107 $_GET = array(); 108 $_REQUEST = array(); 101 109 $_POST['role'] = 'subscriber'; 102 110 $_POST['email'] = 'user2@example.com'; -
trunk/tests/phpunit/tests/user/wpSetCurrentUser.php
r42343 r45588 10 10 11 11 public static function wpSetUpBeforeClass( $factory ) { 12 self::$user_ids[] = self::$user_id = $factory->user->create(); 13 self::$user_ids[] = self::$user_id2 = $factory->user->create( array( 'user_login' => 'foo' ) ); 12 self::$user_id = $factory->user->create(); 13 self::$user_ids[] = self::$user_id; 14 self::$user_id2 = $factory->user->create( array( 'user_login' => 'foo' ) ); 15 self::$user_ids[] = self::$user_id2; 14 16 } 15 17
Note: See TracChangeset
for help on using the changeset viewer.