Changeset 82 in tests
- Timestamp:
- 11/14/2007 09:52:15 PM (18 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_import_wp.php (modified) (48 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_import_wp.php
r79 r82 8 8 function setUp() { 9 9 parent::setUp(); 10 include_once(ABSPATH.'/wp-admin/import/wordpress.php'); 10 11 11 12 # $this->record_queries(); 12 13 13 include_once(ABSPATH.'/wp-admin/import/wordpress.php'); 14 $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-11-09.xml'); 14 15 # echo $this->_generate_post_content_test($this->posts, false); 16 17 } 18 19 function test_select_authors() { 20 21 $users = get_users_of_blog(); 22 23 $importer = new WP_Import(); 24 $importer->file = realpath(DIR_TESTDATA.'/export/asdftestblog1.2007-11-09.xml'); 25 26 $form = get_echo(array(&$importer, 'select_authors')); 27 $form = mask_input_value($form); 28 29 $expected = <<<EOF 30 <h2>Assign Authors</h2> 31 <p>To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.</p> 32 <p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p> 33 <ol id="authors"><form action="?import=wordpress&step=2&id=" method="post"><input type="hidden" name="_wpnonce" value="***" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]"> 34 <option value="#NONE#">- Select -</option> 35 <option value="{$this->author->user_login}">{$this->author->user_login}</option>\t</select> 36 </li><li>Current author: <strong>tellyworthtest2</strong><br />Create user <input type="text" value="tellyworthtest2" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[1]"> 37 <option value="#NONE#">- Select -</option> 38 <option value="{$this->author->user_login}">{$this->author->user_login}</option>\t</select> 39 </li><input type="submit" value="Submit"><br /></form></ol> 40 41 EOF; 42 43 $this->assertEquals( strip_ws($expected), strip_ws($form) ); 44 45 // make sure the importer didn't add users yet 46 $this->assertEquals( $users, get_users_of_blog() ); 47 } 48 49 function test_big_import() { 50 $this->_import_wp(DIR_TESTDATA.'/export/big-export.xml'); 15 51 $this->posts = get_posts('numberposts=500&post_type=&post_status='); 16 17 # echo $this->_generate_post_content_test($this->posts, false); 18 52 $this->assertEquals( 500, count($this->posts) ); 19 53 } 20 54 21 55 function test_all_posts() { 56 $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-11-09.xml', array('User A', 'User B')); 57 $this->posts = get_posts('numberposts=500&post_type=&post_status='); 58 22 59 $post = $this->posts[0]; 23 $this->assertEquals( "0", $post->post_author);60 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 24 61 $this->assertEquals("2027-09-04 10:03:02", $post->post_date); 25 62 $this->assertEquals("2027-09-04 00:03:02", $post->post_date_gmt); … … 52 89 53 90 $post = $this->posts[1]; 54 $this->assertEquals( "0", $post->post_author);91 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 55 92 $this->assertEquals("2007-11-09 11:39:38", $post->post_date); 56 93 $this->assertEquals("2007-11-09 01:39:38", $post->post_date_gmt); … … 87 124 88 125 $post = $this->posts[2]; 89 $this->assertEquals( "0", $post->post_author);126 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 90 127 $this->assertEquals("2007-11-09 11:39:16", $post->post_date); 91 128 $this->assertEquals("2007-11-09 01:39:16", $post->post_date_gmt); … … 122 159 123 160 $post = $this->posts[3]; 124 $this->assertEquals( "0", $post->post_author);161 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 125 162 $this->assertEquals("2007-11-09 11:38:56", $post->post_date); 126 163 $this->assertEquals("2007-11-09 01:38:56", $post->post_date_gmt); … … 157 194 158 195 $post = $this->posts[4]; 159 $this->assertEquals( "0", $post->post_author);196 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 160 197 $this->assertEquals("2007-11-09 11:38:16", $post->post_date); 161 198 $this->assertEquals("2007-11-09 01:38:16", $post->post_date_gmt); … … 190 227 191 228 $post = $this->posts[5]; 192 $this->assertEquals( "0", $post->post_author);229 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 193 230 $this->assertEquals("2007-11-09 11:37:57", $post->post_date); 194 231 $this->assertEquals("2007-11-09 01:37:57", $post->post_date_gmt); … … 223 260 224 261 $post = $this->posts[6]; 225 $this->assertEquals( "0", $post->post_author);262 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 226 263 $this->assertEquals("2007-11-09 11:37:39", $post->post_date); 227 264 $this->assertEquals("2007-11-09 01:37:39", $post->post_date_gmt); … … 256 293 257 294 $post = $this->posts[7]; 258 $this->assertEquals( "0", $post->post_author);295 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 259 296 $this->assertEquals("2007-09-15 16:51:47", $post->post_date); 260 297 $this->assertEquals("2007-09-15 06:51:47", $post->post_date_gmt); … … 293 330 294 331 $post = $this->posts[8]; 295 $this->assertEquals( "0", $post->post_author);332 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 296 333 $this->assertEquals("2007-09-04 12:11:23", $post->post_date); 297 334 $this->assertEquals("2007-09-04 02:11:23", $post->post_date_gmt); … … 324 361 325 362 $post = $this->posts[9]; 326 $this->assertEquals( "0", $post->post_author);363 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 327 364 $this->assertEquals("2007-09-04 11:53:10", $post->post_date); 328 365 $this->assertEquals("2007-09-04 01:53:10", $post->post_date_gmt); … … 355 392 356 393 $post = $this->posts[10]; 357 $this->assertEquals( "0", $post->post_author);394 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 358 395 $this->assertEquals("2007-09-04 10:48:10", $post->post_date); 359 396 $this->assertEquals("2007-09-04 00:48:10", $post->post_date_gmt); … … 386 423 387 424 $post = $this->posts[11]; 388 $this->assertEquals( "0", $post->post_author);425 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 389 426 $this->assertEquals("2007-09-04 10:47:47", $post->post_date); 390 427 $this->assertEquals("2007-09-04 00:47:47", $post->post_date_gmt); … … 417 454 418 455 $post = $this->posts[12]; 419 $this->assertEquals( "0", $post->post_author);456 $this->assertEquals(get_profile('ID', 'User B'), $post->post_author); 420 457 $this->assertEquals("2007-09-04 10:39:56", $post->post_date); 421 458 $this->assertEquals("2007-09-04 00:39:56", $post->post_date_gmt); … … 448 485 449 486 $post = $this->posts[13]; 450 $this->assertEquals( "0", $post->post_author);487 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 451 488 $this->assertEquals("2007-09-04 10:25:29", $post->post_date); 452 489 $this->assertEquals("2007-09-04 00:25:29", $post->post_date_gmt); … … 479 516 480 517 $post = $this->posts[14]; 481 $this->assertEquals( "0", $post->post_author);518 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 482 519 $this->assertEquals("2007-09-04 10:21:15", $post->post_date); 483 520 $this->assertEquals("2007-09-04 00:21:15", $post->post_date_gmt); … … 510 547 511 548 $post = $this->posts[15]; 512 $this->assertEquals( "0", $post->post_author);549 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 513 550 $this->assertEquals("2007-09-04 10:15:26", $post->post_date); 514 551 $this->assertEquals("2007-09-04 00:15:26", $post->post_date_gmt); … … 541 578 542 579 $post = $this->posts[16]; 543 $this->assertEquals( "0", $post->post_author);580 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 544 581 $this->assertEquals("2007-09-04 10:11:37", $post->post_date); 545 582 $this->assertEquals("2007-09-04 00:11:37", $post->post_date_gmt); … … 572 609 573 610 $post = $this->posts[17]; 574 $this->assertEquals( "0", $post->post_author);611 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 575 612 $this->assertEquals("2007-09-04 09:53:18", $post->post_date); 576 613 $this->assertEquals("2007-09-03 23:53:18", $post->post_date_gmt); … … 603 640 604 641 $post = $this->posts[18]; 605 $this->assertEquals( "0", $post->post_author);642 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 606 643 $this->assertEquals("2007-09-04 09:52:50", $post->post_date); 607 644 $this->assertEquals("2007-09-03 23:52:50", $post->post_date_gmt); … … 634 671 635 672 $post = $this->posts[19]; 636 $this->assertEquals( "0", $post->post_author);673 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 637 674 $this->assertEquals("2007-09-04 09:52:18", $post->post_date); 638 675 $this->assertEquals("2007-09-03 23:52:18", $post->post_date_gmt); … … 651 688 $this->assertEquals("2007-09-03 23:52:18", $post->post_modified_gmt); 652 689 $this->assertEquals("", $post->post_content_filtered); 653 $this->assertEquals( "31", $post->post_parent);690 $this->assertEquals($this->posts[20]->ID, $post->post_parent); 654 691 $this->assertEquals(get_permalink($post->ID), $post->guid); 655 692 $this->assertEquals("0", $post->menu_order); … … 665 702 666 703 $post = $this->posts[20]; 667 $this->assertEquals( "0", $post->post_author);704 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 668 705 $this->assertEquals("2007-09-04 09:51:50", $post->post_date); 669 706 $this->assertEquals("2007-09-03 23:51:50", $post->post_date_gmt); … … 682 719 $this->assertEquals("2007-09-03 23:51:50", $post->post_modified_gmt); 683 720 $this->assertEquals("", $post->post_content_filtered); 684 $this->assertEquals( "30", $post->post_parent);721 $this->assertEquals($this->posts[21]->ID, $post->post_parent); 685 722 $this->assertEquals(get_permalink($post->ID), $post->guid); 686 723 $this->assertEquals("0", $post->menu_order); … … 696 733 697 734 $post = $this->posts[21]; 698 $this->assertEquals( "0", $post->post_author);735 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 699 736 $this->assertEquals("2007-09-04 09:51:09", $post->post_date); 700 737 $this->assertEquals("2007-09-03 23:51:09", $post->post_date_gmt); … … 727 764 728 765 $post = $this->posts[22]; 729 $this->assertEquals( "0", $post->post_author);766 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 730 767 $this->assertEquals("2007-09-04 09:44:53", $post->post_date); 731 768 $this->assertEquals("2007-09-03 23:44:53", $post->post_date_gmt); … … 758 795 759 796 $post = $this->posts[23]; 760 $this->assertEquals( "0", $post->post_author);797 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 761 798 $this->assertEquals("2007-09-04 09:44:14", $post->post_date); 762 799 $this->assertEquals("2007-09-03 23:44:14", $post->post_date_gmt); … … 789 826 790 827 $post = $this->posts[24]; 791 $this->assertEquals( "0", $post->post_author);828 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 792 829 $this->assertEquals("2007-09-04 09:43:47", $post->post_date); 793 830 $this->assertEquals("2007-09-03 23:43:47", $post->post_date_gmt); … … 820 857 821 858 $post = $this->posts[25]; 822 $this->assertEquals( "0", $post->post_author);859 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 823 860 $this->assertEquals("2007-09-04 09:43:14", $post->post_date); 824 861 $this->assertEquals("2007-09-03 23:43:14", $post->post_date_gmt); … … 852 889 853 890 $post = $this->posts[26]; 854 $this->assertEquals( "0", $post->post_author);891 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 855 892 $this->assertEquals("2007-09-04 09:42:29", $post->post_date); 856 893 $this->assertEquals("2007-09-03 23:42:29", $post->post_date_gmt); … … 884 921 885 922 $post = $this->posts[27]; 886 $this->assertEquals( "0", $post->post_author);923 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 887 924 $this->assertEquals("2007-09-04 09:41:51", $post->post_date); 888 925 $this->assertEquals("2007-09-03 23:41:51", $post->post_date_gmt); … … 916 953 917 954 $post = $this->posts[28]; 918 $this->assertEquals( "0", $post->post_author);955 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 919 956 $this->assertEquals("2007-09-04 09:41:17", $post->post_date); 920 957 $this->assertEquals("2007-09-03 23:41:17", $post->post_date_gmt); … … 949 986 950 987 $post = $this->posts[29]; 951 $this->assertEquals( "0", $post->post_author);988 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 952 989 $this->assertEquals("2007-09-04 09:39:56", $post->post_date); 953 990 $this->assertEquals("2007-09-03 23:39:56", $post->post_date_gmt); … … 980 1017 981 1018 $post = $this->posts[30]; 982 $this->assertEquals( "0", $post->post_author);1019 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 983 1020 $this->assertEquals("2007-09-04 09:39:23", $post->post_date); 984 1021 $this->assertEquals("2007-09-03 23:39:23", $post->post_date_gmt); … … 1011 1048 1012 1049 $post = $this->posts[31]; 1013 $this->assertEquals( "0", $post->post_author);1050 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1014 1051 $this->assertEquals("2007-09-04 09:38:54", $post->post_date); 1015 1052 $this->assertEquals("2007-09-03 23:38:54", $post->post_date_gmt); … … 1042 1079 1043 1080 $post = $this->posts[32]; 1044 $this->assertEquals( "0", $post->post_author);1081 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1045 1082 $this->assertEquals("2007-09-04 09:38:05", $post->post_date); 1046 1083 $this->assertEquals("2007-09-03 23:38:05", $post->post_date_gmt); … … 1073 1110 1074 1111 $post = $this->posts[33]; 1075 $this->assertEquals( "0", $post->post_author);1112 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1076 1113 $this->assertEquals("2007-09-04 09:37:59", $post->post_date); 1077 1114 $this->assertEquals("2007-09-03 23:37:59", $post->post_date_gmt); … … 1104 1141 1105 1142 $post = $this->posts[34]; 1106 $this->assertEquals( "0", $post->post_author);1143 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1107 1144 $this->assertEquals("2007-09-04 09:36:28", $post->post_date); 1108 1145 $this->assertEquals("2007-09-03 23:36:28", $post->post_date_gmt); … … 1135 1172 1136 1173 $post = $this->posts[35]; 1137 $this->assertEquals( "0", $post->post_author);1174 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1138 1175 $this->assertEquals("2007-09-04 09:35:23", $post->post_date); 1139 1176 $this->assertEquals("2007-09-03 23:35:23", $post->post_date_gmt); … … 1166 1203 1167 1204 $post = $this->posts[36]; 1168 $this->assertEquals( "0", $post->post_author);1205 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1169 1206 $this->assertEquals("2007-09-04 09:31:31", $post->post_date); 1170 1207 $this->assertEquals("2007-09-03 23:31:31", $post->post_date_gmt); … … 1197 1234 1198 1235 $post = $this->posts[37]; 1199 $this->assertEquals( "0", $post->post_author);1236 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1200 1237 $this->assertEquals("2007-09-04 09:30:02", $post->post_date); 1201 1238 $this->assertEquals("2007-09-03 23:30:02", $post->post_date_gmt); … … 1228 1265 1229 1266 $post = $this->posts[38]; 1230 $this->assertEquals( "0", $post->post_author);1267 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1231 1268 $this->assertEquals("2007-09-04 09:22:14", $post->post_date); 1232 1269 $this->assertEquals("2007-09-03 23:22:14", $post->post_date_gmt); … … 1261 1298 1262 1299 $post = $this->posts[39]; 1263 $this->assertEquals( "0", $post->post_author);1300 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1264 1301 $this->assertEquals("2007-09-04 09:18:44", $post->post_date); 1265 1302 $this->assertEquals("2007-09-03 23:18:44", $post->post_date_gmt); … … 1292 1329 1293 1330 $post = $this->posts[40]; 1294 $this->assertEquals( "0", $post->post_author);1331 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1295 1332 $this->assertEquals("2007-09-03 23:15:10", $post->post_date); 1296 1333 $this->assertEquals("2007-09-03 23:15:10", $post->post_date_gmt); … … 1322 1359 1323 1360 1361 1324 1362 $post = $this->posts[41]; 1325 $this->assertEquals( "0", $post->post_author);1363 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1326 1364 $this->assertEquals("2007-09-03 23:08:37", $post->post_date); 1327 1365 $this->assertEquals("2007-09-03 23:08:37", $post->post_date_gmt); … … 1354 1392 1355 1393 $post = $this->posts[42]; 1356 $this->assertEquals( "0", $post->post_author);1394 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1357 1395 $this->assertEquals("2007-09-03 23:08:37", $post->post_date); 1358 1396 $this->assertEquals("2007-09-03 23:08:37", $post->post_date_gmt); … … 1385 1423 1386 1424 $post = $this->posts[43]; 1387 $this->assertEquals( "0", $post->post_author);1425 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1388 1426 $this->assertEquals("2007-09-03 17:17:01", $post->post_date); 1389 1427 $this->assertEquals("2007-09-03 23:17:01", $post->post_date_gmt); … … 1416 1454 1417 1455 $post = $this->posts[44]; 1418 $this->assertEquals( "0", $post->post_author);1456 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1419 1457 $this->assertEquals("1982-01-01 11:11:15", $post->post_date); 1420 1458 $this->assertEquals("1982-01-01 01:11:15", $post->post_date_gmt); … … 1509 1547 1510 1548 $post = $this->posts[47]; 1511 $this->assertEquals( "0", $post->post_author);1549 $this->assertEquals(get_profile('ID', 'User A'), $post->post_author); 1512 1550 $this->assertEquals("0000-00-00 00:00:00", $post->post_date); 1513 1551 $this->assertEquals("0000-00-00 00:00:00", $post->post_date_gmt);
Note: See TracChangeset
for help on using the changeset viewer.