<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[366] wp-testcase: Set svn:eol-style native on all but one of the testcases.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>366</dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2011-06-05 07:25:21 +0000 (Sun, 05 Jun 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Set svn:eol-style native on all but one of the testcases.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#wptestcasejacobTestFormattingphp">wp-testcase/jacob/TestFormatting.php</a></li>
<li><a href="#wptestcasetest_cronphp">wp-testcase/test_cron.php</a></li>
<li><a href="#wptestcasetest_filtersphp">wp-testcase/test_filters.php</a></li>
<li><a href="#wptestcasetest_httpphp">wp-testcase/test_http.php</a></li>
<li><a href="#wptestcasetest_import_wpphp">wp-testcase/test_import_wp.php</a></li>
<li><a href="#wptestcasetest_post_outputphp">wp-testcase/test_post_output.php</a></li>
<li><a href="#wptestcasetest_queryphp">wp-testcase/test_query.php</a></li>
<li><a href="#wptestcasetest_userphp">wp-testcase/test_user.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#wptestcasejacobTestFormattingphp">wp-testcase/jacob/TestFormatting.php</a></li>
<li><a href="#wptestcasetest_admin_includes_pluginphp">wp-testcase/test_admin_includes_plugin.php</a></li>
<li><a href="#wptestcasetest_admin_includes_templatephp">wp-testcase/test_admin_includes_template.php</a></li>
<li><a href="#wptestcasetest_admin_includes_themephp">wp-testcase/test_admin_includes_theme.php</a></li>
<li><a href="#wptestcasetest_cronphp">wp-testcase/test_cron.php</a></li>
<li><a href="#wptestcasetest_filtersphp">wp-testcase/test_filters.php</a></li>
<li><a href="#wptestcasetest_httpphp">wp-testcase/test_http.php</a></li>
<li><a href="#wptestcasetest_imagephp">wp-testcase/test_image.php</a></li>
<li><a href="#wptestcasetest_import_wpphp">wp-testcase/test_import_wp.php</a></li>
<li><a href="#wptestcasetest_includes_cachephp">wp-testcase/test_includes_cache.php</a></li>
<li><a href="#wptestcasetest_includes_classwpdependenciesphp">wp-testcase/test_includes_class-wp-dependencies.php</a></li>
<li><a href="#wptestcasetest_includes_compatphp">wp-testcase/test_includes_compat.php</a></li>
<li><a href="#wptestcasetest_includes_feed_rss2php">wp-testcase/test_includes_feed_rss2.php</a></li>
<li><a href="#wptestcasetest_includes_filephp">wp-testcase/test_includes_file.php</a></li>
<li><a href="#wptestcasetest_includes_formattingphp">wp-testcase/test_includes_formatting.php</a></li>
<li><a href="#wptestcasetest_includes_functionsphp">wp-testcase/test_includes_functions.php</a></li>
<li><a href="#wptestcasetest_includes_pluggablephp">wp-testcase/test_includes_pluggable.php</a></li>
<li><a href="#wptestcasetest_includes_postphp">wp-testcase/test_includes_post.php</a></li>
<li><a href="#wptestcasetest_includes_taxonomyphp">wp-testcase/test_includes_taxonomy.php</a></li>
<li><a href="#wptestcasetest_includes_themephp">wp-testcase/test_includes_theme.php</a></li>
<li><a href="#wptestcasetest_includes_wpscriptsphp">wp-testcase/test_includes_wp-scripts.php</a></li>
<li><a href="#wptestcasetest_includes_wpstylesphp">wp-testcase/test_includes_wp-styles.php</a></li>
<li><a href="#wptestcasetest_link_functionsphp">wp-testcase/test_link_functions.php</a></li>
<li><a href="#wptestcasetest_metaphp">wp-testcase/test_meta.php</a></li>
<li><a href="#wptestcasetest_post_filteringphp">wp-testcase/test_post_filtering.php</a></li>
<li><a href="#wptestcasetest_post_outputphp">wp-testcase/test_post_output.php</a></li>
<li><a href="#wptestcasetest_queryphp">wp-testcase/test_query.php</a></li>
<li><a href="#wptestcasetest_query_resultsphp">wp-testcase/test_query_results.php</a></li>
<li><a href="#wptestcasetest_shortcodephp">wp-testcase/test_shortcode.php</a></li>
<li><a href="#wptestcasetest_uploadsphp">wp-testcase/test_uploads.php</a></li>
<li><a href="#wptestcasetest_userphp">wp-testcase/test_user.php</a></li>
<li><a href="#wptestcasetest_user_capabilitiesphp">wp-testcase/test_user_capabilities.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="wptestcasejacobTestFormattingphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/jacob/TestFormatting.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/jacob/TestFormatting.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/jacob/TestFormatting.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,447 +1,447 @@
</span><del>-<?php
-
-/*
-From http://wordpress.svn.dragonu.net/unittest/wp-unittest/UnitTests/
-*/
-class _WPFormattingTest extends WPTestCase {
- function file_test($name, $callback) {
- $input = $this->get_testdata($name . ".input.txt");
- $output = $this->get_testdata($name . ".output.txt");
- for ($i=0; $i<count($input); ++$i) {
- $in = call_user_func($callback, $input[$i]);
- $this->assertEquals($output[$i], $in);
- }
- }
-
-        /*
-        Get test data from files, one test per line.
-        Comments start with "###".
-        */
-        function get_testdata($name) {
-                $data = file( DIR_TESTDATA.'/jacob/'.$name );
-                $odata = array();
-                foreach ($data as $datum) {
-                 // comment
-                 $commentpos = strpos($datum, "###");
-                 if ($commentpos !== false) {
-                 $datum = trim(substr($datum, 0, $commentpos));
-                 if (!$datum)
-                 continue;
-                 }
-                 $odata[] = $datum;
-                }
-                return $odata;
-        }
-}
-
-
-/* The `clean_pre` function removes pararaph and line break
- tags within `<pre>` elements as part of the nightmare that
- is `wpautop`. */
-class Test_Clean_Pre extends _WPFormattingTest {
- function test_removes_self_closing_br_with_space() {
- $source = 'a b c\n<br />sldfj<br />';
- $res = 'a b c\nsldfj';
-
- $this->assertEquals($res, clean_pre($source));
- }
- function test_removes_self_closing_br_without_space() {
- $source = 'a b c\n<br/>sldfj<br/>';
- $res = 'a b c\nsldfj';
- $this->assertEquals($res, clean_pre($source));
- }
- // I don't think this can ever happen in production;
- // <br> is changed to <br /> elsewhere. Left in because
- // that replacement shouldn't happen (what if you want
- // HTML 4 output?).
- function test_removes_html_br() {
- $source = 'a b c\n<br>sldfj<br>';
- $res = 'a b c\nsldfj';
- $this->assertEquals($res, clean_pre($source));
- }
- function test_removes_p() {
- $source = "<p>isn't this exciting!</p><p>oh indeed!</p>";
- $res = "\nisn't this exciting!\noh indeed!";
- $this->assertEquals($res, clean_pre($source));
- }
-}
-
-/*
-`seems_utf8` returns true for utf-8 strings, false otherwise.
-*/
-class Test_Seems_UTF8 extends _WPFormattingTest {
- function test_returns_true_for_utf8_strings() {
- // from http://www.i18nguy.com/unicode-example.html
- $utf8 = $this->get_testdata('utf-8.txt');
- $this->assertTrue(count($utf8) > 3);
- foreach ($utf8 as $string) {
- $this->assertTrue(seems_utf8($string));
- }
- }
- function test_returns_false_for_non_utf8_strings() {
- $big5 = $this->get_testdata('test_big5.txt');
- $big5 = $big5[0];
- $strings = array(
- "abc",
- "123",
- $big5
- );
- }
-}
-
-/*
-Escapes HTML special characters (&, <, >); does not encode
-ampersands if they are already part of entities.
-*/
-class Test_WP_Specialchars extends _WPFormattingTest {
- function test_escapes_ampersands() {
- $source = "penn & teller & at&t";
- $res = "penn &amp; teller &amp; at&amp;t";
- $this->assertEquals( $res, esc_html($source) );
- }
- function test_escapes_greater_and_less_than() {
- $source = "this > that < that <randomhtml />";
- $res = "this &gt; that &lt; that &lt;randomhtml /&gt;";
- $this->assertEquals( $res, esc_html($source) );
- }
- function test_optionally_escapes_quotes() {
- $source = "\"'hello!'\"";
- $this->assertEquals( '"&#039;hello!&#039;"', _wp_specialchars($source, 'single') );
- $this->assertEquals( "&quot;'hello!'&quot;", _wp_specialchars($source, 'double') );
- $this->assertEquals( '&quot;&#039;hello!&#039;&quot;', _wp_specialchars($source, true) );
- $this->assertEquals( $source, _wp_specialchars($source) );
- }
- function test_ignores_existing_entities() {
- $source = '&#038; &#x00A3; &#x22; &amp;';
- $res = '&amp; &#xA3; &quot; &amp;';
- $this->assertEquals( $res, esc_html($source) );
- }
-}
-
-class Test_UTF8_URI_Encode extends _WPFormattingTest {
- /*
- Non-ASCII UTF-8 characters should be percent encoded. Spaces etc.
- are dealt with elsewhere.
- */
- function test_percent_encodes_non_reserved_characters() {
- $utf8urls = $this->get_testdata('utf-8.txt');
- $urlencoded = $this->get_testdata('utf-8-urlencoded.txt');
- for ($i=0; $i<count($utf8urls); ++$i) {
- $this->assertEquals($urlencoded[$i], utf8_uri_encode($utf8urls[$i]));
- }
- }
- function test_output_is_not_longer_than_optional_length_argument() {
- $utf8urls = $this->get_testdata('utf-8.txt');
- foreach ($utf8urls as $url) {
- $maxlen = rand(5, 200);
- $this->assertTrue(strlen(utf8_uri_encode($url, $maxlen)) <= $maxlen);
- }
-
- }
-
-}
-
-/*
-Removes accents from characters and decomposes ligatures.
-*/
-class Test_Remove_Accents extends _WPFormattingTest {
-
- /*
- http://www.alanwood.net/unicode/latin_1_supplement.html
-
- unicode-latin-1-supplement is identical to iso-8859-1, so these
- tests on their own will never take the unicode codepath
- */
- function test_removes_accents_from_decomposable_latin1_supplement() {
- $this->file_test("removes_accents_from_decomposable_latin1_supplement",
- "remove_accents");
- }
-
- /*
- Several characters, such as eth and thorn, do not have a unicode
- decomposition, but should be replaced. The eth, for example, should become
- "d" or "dh", and the thorn "th". They require special rules.
- */
- function test_removes_accents_from_undecomposable_latin1_supplement() {
- $this->file_test("removes_accents_from_undecomposable_latin1_supplement",
- "remove_accents");
- }
- function test_removes_accents_from_latin1_supplement() {
- $this->file_test("removes_accents_from_latin1_supplement",
- "remove_accents");
- }
-
- function test_removes_accents_from_decomposable_latin_extended_a() {
- $this->file_test("removes_accents_from_decomposable_latin_extended_a",
- "remove_accents");
- }
- function test_removes_accents_from_undecomposable_latin_extended_a() {
- $this->file_test("removes_accents_from_undecomposable_latin_extended_a",
- "remove_accents");
- }
- function test_removes_accents_from_latin_extended_a() {
- $this->file_test("removes_accents_from_latin_extended_a",
- "remove_accents");
- }
-
- // Currently this test fails because the unicode codepath (seems_utf8 == true)
- // can't handle non-decomposable characters (eth and friends).
- function test_removes_accents_from_latin1_supplement_and_latin_extended_a() {
- $this->file_test("removes_accents_from_latin1_supplement_and_latin_extended_a",
- "remove_accents");
- }
-}
-
-/*
-Sanitizes filenames.
-*/
-class Test_Sanitize_File_Name extends _WPFormattingTest {
- function test_makes_lowercase() {
- $this->assertEquals("att", sanitize_file_name("ATT"));
- }
- function test_removes_entities() {
- $this->assertEquals("att", sanitize_file_name("at&amp;t"));
- }
- function test_replaces_underscores_with_hyphens() {
- $this->assertEquals("a-t-t", sanitize_file_name("a_t_t"));
- }
- function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
- $this->assertEquals("a-t", sanitize_file_name("a t"));
- $this->assertEquals("a-t", sanitize_file_name("a \n\n\nt"));
- }
- function test_replaces_any_number_of_hyphens_with_one_hyphen() {
- $this->assertEquals("a-t-t", sanitize_file_name("a----t----t"));
- }
- function test_trims_trailing_hyphens() {
- $this->assertEquals("a-t-t", sanitize_file_name("a----t----t----"));
- }
- function test_strips_anything_but_alphanums_periods_and_hyphens() {
- $this->assertEquals("saint-sans", sanitize_file_name("S%ain%t-S%a\xEBns"));
- }
- function test_handles_non_entity_ampersands() {
- $this->assertEquals("penn-teller-bull", sanitize_file_name("penn & teller; bull"));
- }
-}
-
-/*
-Mathilda: Do you "clean" anyone?
-L\xE9on: No women, no kids, that's the rules.
-*/
-class Test_Sanitize_User extends _WPFormattingTest {
- function test_strips_html() {
- $input = "Captain <strong>Awesome</strong>";
- $expected = "Captain Awesome";
- $this->assertEquals($expected, sanitize_user($input));
- }
- function test_strips_entities() {
- $this->assertEquals("ATT", sanitize_user("AT&amp;T"));
- }
- function test_strips_percent_encoded_octets() {
- $this->assertEquals("Franois", sanitize_user("Fran%c3%a7ois"));
- }
- function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
- $this->assertEquals("aboco", sanitize_user("()~ab~\xF6c\xF6!", true));
- }
-}
-
-class Test_Sanitize_Title extends _WPFormattingTest {
- function test_strips_html() {
- $input = "Captain <strong>Awesome</strong>";
- $expected = "captain-awesome";
- $this->assertEquals($expected, sanitize_title($input));
- }
-
- function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
- $input = "<strong></strong>";
- $fallback = "Captain Awesome";
- $this->assertEquals($fallback, sanitize_title($input, $fallback));
- }
-}
-
-class Test_Sanitize_Title_With_Dashes extends _WPFormattingTest {
- function test_strips_html() {
- $input = "Captain <strong>Awesome</strong>";
- $expected = "captain-awesome";
- $this->assertEquals($expected, sanitize_title($input));
- }
- function test_strips_unencoded_percent_signs() {
- $this->assertEquals("fran%c3%a7ois", sanitize_title_with_dashes("fran%c3%a7%ois"));
- }
- function test_makes_title_lowercase() {
- $this->assertEquals("abc", sanitize_title_with_dashes("ABC"));
- }
- function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
- $this->assertEquals("a-t", sanitize_title_with_dashes("a t"));
- $this->assertEquals("a-t", sanitize_title_with_dashes("a \n\n\nt"));
- }
- function test_replaces_any_number_of_hyphens_with_one_hyphen() {
- $this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t"));
- }
- function test_trims_trailing_hyphens() {
- $this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t----"));
- }
- function test_handles_non_entity_ampersands() {
- $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull"));
- }
-}
-
-/*
-`convert_chars` is a poorly named function that does
-four unrelated tasks. ;)
-*/
-class Test_Convert_Chars extends _WPFormattingTest {
- function test_replaces_windows1252_entities_with_unicode_ones() {
- $input = "&#130;&#131;&#132;&#133;&#134;&#135;&#136;&#137;&#138;&#139;&#140;&#145;&#146;&#147;&#148;&#149;&#150;&#151;&#152;&#153;&#154;&#155;&#156;&#159;";
- $output = "&#8218;&#402;&#8222;&#8230;&#8224;&#8225;&#710;&#8240;&#352;&#8249;&#338;&#8216;&#8217;&#8220;&#8221;&#8226;&#8211;&#8212;&#732;&#8482;&#353;&#8250;&#339;&#376;";
- $this->assertEquals($output, convert_chars($input));
- }
- function test_converts_html_br_and_hr_to_the_xhtml_self_closing_variety() {
- $inputs = array(
- "abc <br> lol <br />" => "abc <br /> lol <br />",
- "<BR> HO HO <HR>" => "<br /> ho ho <hr />",
- "<hr><br>" => "<hr /><br />"
- );
- foreach ($inputs as $input => $expected) {
- $this->assertEquals($expected, convert_chars($input));
- }
- }
- function test_escapes_lone_ampersands() {
- $this->assertEquals("at&#038;t", convert_chars("at&t"));
- }
- // what the hell are these? O_o
- function test_removes_category_and_title_metadata_tags() {
- $this->assertEquals("", convert_chars("<title><div class='lol'>abc</div></title><category>a</category>"));
- }
-}
-
-class Test_Funky_JavaScript_Fix extends _WPFormattingTest {
- function test_does_nothing_if_not_mac_or_win_ie() {
- global $is_macIE, $is_winIE;
- $prev = array($is_macIE, $is_winIE);
- $is_macIE = $is_winIE = false;
- $data = $this->get_testdata("utf-8-u-urlencoded.txt");
- foreach ($data as $datum) {
- $this->assertEquals($datum, funky_javascript_fix($datum));
- }
- $is_macIE = $prev[0];
- $is_winIE = $prev[1];
- }
- function test_converts_u_percent_encoded_values_if_mac_ie() {
- global $is_macIE;
- $prev = $is_macIE;
- $is_macIE = true;
- $this->_run();
- $is_macIE = $prev;
- }
- function test_converts_u_percent_encoded_values_if_win_ie() {
- global $is_winIE;
- $prev = $is_winIE;
- $is_winIE = true;
- $this->_run();
- $is_winIE = $prev;
- }
- function _run() {
- $input = $this->get_testdata("utf-8-u-urlencoded.txt");
- $output = $this->get_testdata("utf-8-entitized.txt");
- for ($i=0; $i<count($input); ++$i) {
- $this->assertEquals($output[$i], funky_javascript_fix($input[$i]));
- }
- }
-}
-
-
-class Test_BalanceTags extends _WPFormattingTest {
- function test_adds_missing_end_tags() {
- $this->assertEquals("<b><i>abc</i></b>", balanceTags("<b><i>abc</b>", true));
- }
- function test_fixes_simple_bad_nesting() {
- $this->assertEquals("<b><i>abc</i></b>", balanceTags("<b><i>abc</b></i>", true));
- }
-}
-
-class Test_Zeroise extends _WPFormattingTest {
- function test_pads_with_leading_zeroes() {
- $this->assertEquals("00005", zeroise(5, 5));
- }
- function test_does_nothing_if_input_is_already_longer() {
- $this->assertEquals("5000000", zeroise(5000000, 2));
- }
-}
-
-class Test_Backslashit extends _WPFormattingTest {
- function test_backslashes_alphas() {
- $this->assertEquals("\\a943\\b\\c", backslashit("a943bc"));
- }
- function test_double_backslashes_leading_numbers() {
- $this->assertEquals("\\\\95", backslashit("95"));
- }
-}
-
-class Test_Untrailingslashit extends _WPFormattingTest {
- function test_removes_trailing_slashes() {
- $this->assertEquals("a", untrailingslashit("a/"));
- $this->assertEquals("a", untrailingslashit("a////"));
- }
-}
-
-class Test_Trailingslashit extends _WPFormattingTest {
- function test_adds_trailing_slash() {
- $this->assertEquals("a/", trailingslashit("a"));
- }
- function test_does_not_add_trailing_slash_if_one_exists() {
- $this->assertEquals("a/", trailingslashit("a/"));
- }
-}
-
-class Test_Is_Email extends _WPFormattingTest {
- function test_returns_true_if_given_a_valid_email_address() {
- $data = array(
- "bob@example.com",
- '"Bob Johnson" <bob@example.com>',
- "phil@example.info",
- "ace@204.32.222.14",
- "kevin@many.subdomains.make.a.happy.man.edu"
- );
- foreach ( $data as $datum ) {
- $this->assertEquals( $datum, is_email($datum), $datum );
- }
- }
- // TODO: make up some more useful test data :)
- function test_returns_false_if_given_an_invalid_email_address() {
- $data = array(
- "khaaaaaaaaaaaaaaan!",
- 'http://bob.example.com/',
- "sif i'd give u it, spamer!1",
- "com.exampleNOSPAMbob",
- "bob@your mom"
- );
- foreach ($data as $datum) {
- $this->assertFalse(is_email($datum), $datum);
- }
- }
-}
-
-/*
-Decodes text in RFC2047 "Q"-encoding, e.g.
-
- =?iso-8859-1?q?this=20is=20some=20text?=
-*/
-class Test_WP_ISO_Descrambler extends _WPFormattingTest {
- function test_decodes_iso_8859_1_rfc2047_q_encoding() {
- $this->assertEquals("this is some text", wp_iso_descrambler("=?iso-8859-1?q?this=20is=20some=20text?="));
- }
-}
-
-class Test_Ent2NCR extends _WPFormattingTest {
- function test_converts_named_entities_to_numeric_character_references() {
- $data = $this->get_testdata("entities.txt");
- foreach ($data as $datum) {
- $parts = explode("|", $datum);
- $name = "&" . trim($parts[0]) . ";";
- $ncr = trim($parts[1]);
- $this->assertEquals("&#".$ncr.";", ent2ncr($name), $name);
- }
- }
-}
-
-?>
</del><ins>+<?php
+
+/*
+From http://wordpress.svn.dragonu.net/unittest/wp-unittest/UnitTests/
+*/
+class _WPFormattingTest extends WPTestCase {
+ function file_test($name, $callback) {
+ $input = $this->get_testdata($name . ".input.txt");
+ $output = $this->get_testdata($name . ".output.txt");
+ for ($i=0; $i<count($input); ++$i) {
+ $in = call_user_func($callback, $input[$i]);
+ $this->assertEquals($output[$i], $in);
+ }
+ }
+
+        /*
+        Get test data from files, one test per line.
+        Comments start with "###".
+        */
+        function get_testdata($name) {
+                $data = file( DIR_TESTDATA.'/jacob/'.$name );
+                $odata = array();
+                foreach ($data as $datum) {
+                 // comment
+                 $commentpos = strpos($datum, "###");
+                 if ($commentpos !== false) {
+                 $datum = trim(substr($datum, 0, $commentpos));
+                 if (!$datum)
+                 continue;
+                 }
+                 $odata[] = $datum;
+                }
+                return $odata;
+        }
+}
+
+
+/* The `clean_pre` function removes pararaph and line break
+ tags within `<pre>` elements as part of the nightmare that
+ is `wpautop`. */
+class Test_Clean_Pre extends _WPFormattingTest {
+ function test_removes_self_closing_br_with_space() {
+ $source = 'a b c\n<br />sldfj<br />';
+ $res = 'a b c\nsldfj';
+
+ $this->assertEquals($res, clean_pre($source));
+ }
+ function test_removes_self_closing_br_without_space() {
+ $source = 'a b c\n<br/>sldfj<br/>';
+ $res = 'a b c\nsldfj';
+ $this->assertEquals($res, clean_pre($source));
+ }
+ // I don't think this can ever happen in production;
+ // <br> is changed to <br /> elsewhere. Left in because
+ // that replacement shouldn't happen (what if you want
+ // HTML 4 output?).
+ function test_removes_html_br() {
+ $source = 'a b c\n<br>sldfj<br>';
+ $res = 'a b c\nsldfj';
+ $this->assertEquals($res, clean_pre($source));
+ }
+ function test_removes_p() {
+ $source = "<p>isn't this exciting!</p><p>oh indeed!</p>";
+ $res = "\nisn't this exciting!\noh indeed!";
+ $this->assertEquals($res, clean_pre($source));
+ }
+}
+
+/*
+`seems_utf8` returns true for utf-8 strings, false otherwise.
+*/
+class Test_Seems_UTF8 extends _WPFormattingTest {
+ function test_returns_true_for_utf8_strings() {
+ // from http://www.i18nguy.com/unicode-example.html
+ $utf8 = $this->get_testdata('utf-8.txt');
+ $this->assertTrue(count($utf8) > 3);
+ foreach ($utf8 as $string) {
+ $this->assertTrue(seems_utf8($string));
+ }
+ }
+ function test_returns_false_for_non_utf8_strings() {
+ $big5 = $this->get_testdata('test_big5.txt');
+ $big5 = $big5[0];
+ $strings = array(
+ "abc",
+ "123",
+ $big5
+ );
+ }
+}
+
+/*
+Escapes HTML special characters (&, <, >); does not encode
+ampersands if they are already part of entities.
+*/
+class Test_WP_Specialchars extends _WPFormattingTest {
+ function test_escapes_ampersands() {
+ $source = "penn & teller & at&t";
+ $res = "penn &amp; teller &amp; at&amp;t";
+ $this->assertEquals( $res, esc_html($source) );
+ }
+ function test_escapes_greater_and_less_than() {
+ $source = "this > that < that <randomhtml />";
+ $res = "this &gt; that &lt; that &lt;randomhtml /&gt;";
+ $this->assertEquals( $res, esc_html($source) );
+ }
+ function test_optionally_escapes_quotes() {
+ $source = "\"'hello!'\"";
+ $this->assertEquals( '"&#039;hello!&#039;"', _wp_specialchars($source, 'single') );
+ $this->assertEquals( "&quot;'hello!'&quot;", _wp_specialchars($source, 'double') );
+ $this->assertEquals( '&quot;&#039;hello!&#039;&quot;', _wp_specialchars($source, true) );
+ $this->assertEquals( $source, _wp_specialchars($source) );
+ }
+ function test_ignores_existing_entities() {
+ $source = '&#038; &#x00A3; &#x22; &amp;';
+ $res = '&amp; &#xA3; &quot; &amp;';
+ $this->assertEquals( $res, esc_html($source) );
+ }
+}
+
+class Test_UTF8_URI_Encode extends _WPFormattingTest {
+ /*
+ Non-ASCII UTF-8 characters should be percent encoded. Spaces etc.
+ are dealt with elsewhere.
+ */
+ function test_percent_encodes_non_reserved_characters() {
+ $utf8urls = $this->get_testdata('utf-8.txt');
+ $urlencoded = $this->get_testdata('utf-8-urlencoded.txt');
+ for ($i=0; $i<count($utf8urls); ++$i) {
+ $this->assertEquals($urlencoded[$i], utf8_uri_encode($utf8urls[$i]));
+ }
+ }
+ function test_output_is_not_longer_than_optional_length_argument() {
+ $utf8urls = $this->get_testdata('utf-8.txt');
+ foreach ($utf8urls as $url) {
+ $maxlen = rand(5, 200);
+ $this->assertTrue(strlen(utf8_uri_encode($url, $maxlen)) <= $maxlen);
+ }
+
+ }
+
+}
+
+/*
+Removes accents from characters and decomposes ligatures.
+*/
+class Test_Remove_Accents extends _WPFormattingTest {
+
+ /*
+ http://www.alanwood.net/unicode/latin_1_supplement.html
+
+ unicode-latin-1-supplement is identical to iso-8859-1, so these
+ tests on their own will never take the unicode codepath
+ */
+ function test_removes_accents_from_decomposable_latin1_supplement() {
+ $this->file_test("removes_accents_from_decomposable_latin1_supplement",
+ "remove_accents");
+ }
+
+ /*
+ Several characters, such as eth and thorn, do not have a unicode
+ decomposition, but should be replaced. The eth, for example, should become
+ "d" or "dh", and the thorn "th". They require special rules.
+ */
+ function test_removes_accents_from_undecomposable_latin1_supplement() {
+ $this->file_test("removes_accents_from_undecomposable_latin1_supplement",
+ "remove_accents");
+ }
+ function test_removes_accents_from_latin1_supplement() {
+ $this->file_test("removes_accents_from_latin1_supplement",
+ "remove_accents");
+ }
+
+ function test_removes_accents_from_decomposable_latin_extended_a() {
+ $this->file_test("removes_accents_from_decomposable_latin_extended_a",
+ "remove_accents");
+ }
+ function test_removes_accents_from_undecomposable_latin_extended_a() {
+ $this->file_test("removes_accents_from_undecomposable_latin_extended_a",
+ "remove_accents");
+ }
+ function test_removes_accents_from_latin_extended_a() {
+ $this->file_test("removes_accents_from_latin_extended_a",
+ "remove_accents");
+ }
+
+ // Currently this test fails because the unicode codepath (seems_utf8 == true)
+ // can't handle non-decomposable characters (eth and friends).
+ function test_removes_accents_from_latin1_supplement_and_latin_extended_a() {
+ $this->file_test("removes_accents_from_latin1_supplement_and_latin_extended_a",
+ "remove_accents");
+ }
+}
+
+/*
+Sanitizes filenames.
+*/
+class Test_Sanitize_File_Name extends _WPFormattingTest {
+ function test_makes_lowercase() {
+ $this->assertEquals("att", sanitize_file_name("ATT"));
+ }
+ function test_removes_entities() {
+ $this->assertEquals("att", sanitize_file_name("at&amp;t"));
+ }
+ function test_replaces_underscores_with_hyphens() {
+ $this->assertEquals("a-t-t", sanitize_file_name("a_t_t"));
+ }
+ function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+ $this->assertEquals("a-t", sanitize_file_name("a t"));
+ $this->assertEquals("a-t", sanitize_file_name("a \n\n\nt"));
+ }
+ function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+ $this->assertEquals("a-t-t", sanitize_file_name("a----t----t"));
+ }
+ function test_trims_trailing_hyphens() {
+ $this->assertEquals("a-t-t", sanitize_file_name("a----t----t----"));
+ }
+ function test_strips_anything_but_alphanums_periods_and_hyphens() {
+ $this->assertEquals("saint-sans", sanitize_file_name("S%ain%t-S%a\xEBns"));
+ }
+ function test_handles_non_entity_ampersands() {
+ $this->assertEquals("penn-teller-bull", sanitize_file_name("penn & teller; bull"));
+ }
+}
+
+/*
+Mathilda: Do you "clean" anyone?
+L\xE9on: No women, no kids, that's the rules.
+*/
+class Test_Sanitize_User extends _WPFormattingTest {
+ function test_strips_html() {
+ $input = "Captain <strong>Awesome</strong>";
+ $expected = "Captain Awesome";
+ $this->assertEquals($expected, sanitize_user($input));
+ }
+ function test_strips_entities() {
+ $this->assertEquals("ATT", sanitize_user("AT&amp;T"));
+ }
+ function test_strips_percent_encoded_octets() {
+ $this->assertEquals("Franois", sanitize_user("Fran%c3%a7ois"));
+ }
+ function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
+ $this->assertEquals("aboco", sanitize_user("()~ab~\xF6c\xF6!", true));
+ }
+}
+
+class Test_Sanitize_Title extends _WPFormattingTest {
+ function test_strips_html() {
+ $input = "Captain <strong>Awesome</strong>";
+ $expected = "captain-awesome";
+ $this->assertEquals($expected, sanitize_title($input));
+ }
+
+ function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
+ $input = "<strong></strong>";
+ $fallback = "Captain Awesome";
+ $this->assertEquals($fallback, sanitize_title($input, $fallback));
+ }
+}
+
+class Test_Sanitize_Title_With_Dashes extends _WPFormattingTest {
+ function test_strips_html() {
+ $input = "Captain <strong>Awesome</strong>";
+ $expected = "captain-awesome";
+ $this->assertEquals($expected, sanitize_title($input));
+ }
+ function test_strips_unencoded_percent_signs() {
+ $this->assertEquals("fran%c3%a7ois", sanitize_title_with_dashes("fran%c3%a7%ois"));
+ }
+ function test_makes_title_lowercase() {
+ $this->assertEquals("abc", sanitize_title_with_dashes("ABC"));
+ }
+ function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+ $this->assertEquals("a-t", sanitize_title_with_dashes("a t"));
+ $this->assertEquals("a-t", sanitize_title_with_dashes("a \n\n\nt"));
+ }
+ function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+ $this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t"));
+ }
+ function test_trims_trailing_hyphens() {
+ $this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t----"));
+ }
+ function test_handles_non_entity_ampersands() {
+ $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull"));
+ }
+}
+
+/*
+`convert_chars` is a poorly named function that does
+four unrelated tasks. ;)
+*/
+class Test_Convert_Chars extends _WPFormattingTest {
+ function test_replaces_windows1252_entities_with_unicode_ones() {
+ $input = "&#130;&#131;&#132;&#133;&#134;&#135;&#136;&#137;&#138;&#139;&#140;&#145;&#146;&#147;&#148;&#149;&#150;&#151;&#152;&#153;&#154;&#155;&#156;&#159;";
+ $output = "&#8218;&#402;&#8222;&#8230;&#8224;&#8225;&#710;&#8240;&#352;&#8249;&#338;&#8216;&#8217;&#8220;&#8221;&#8226;&#8211;&#8212;&#732;&#8482;&#353;&#8250;&#339;&#376;";
+ $this->assertEquals($output, convert_chars($input));
+ }
+ function test_converts_html_br_and_hr_to_the_xhtml_self_closing_variety() {
+ $inputs = array(
+ "abc <br> lol <br />" => "abc <br /> lol <br />",
+ "<BR> HO HO <HR>" => "<br /> ho ho <hr />",
+ "<hr><br>" => "<hr /><br />"
+ );
+ foreach ($inputs as $input => $expected) {
+ $this->assertEquals($expected, convert_chars($input));
+ }
+ }
+ function test_escapes_lone_ampersands() {
+ $this->assertEquals("at&#038;t", convert_chars("at&t"));
+ }
+ // what the hell are these? O_o
+ function test_removes_category_and_title_metadata_tags() {
+ $this->assertEquals("", convert_chars("<title><div class='lol'>abc</div></title><category>a</category>"));
+ }
+}
+
+class Test_Funky_JavaScript_Fix extends _WPFormattingTest {
+ function test_does_nothing_if_not_mac_or_win_ie() {
+ global $is_macIE, $is_winIE;
+ $prev = array($is_macIE, $is_winIE);
+ $is_macIE = $is_winIE = false;
+ $data = $this->get_testdata("utf-8-u-urlencoded.txt");
+ foreach ($data as $datum) {
+ $this->assertEquals($datum, funky_javascript_fix($datum));
+ }
+ $is_macIE = $prev[0];
+ $is_winIE = $prev[1];
+ }
+ function test_converts_u_percent_encoded_values_if_mac_ie() {
+ global $is_macIE;
+ $prev = $is_macIE;
+ $is_macIE = true;
+ $this->_run();
+ $is_macIE = $prev;
+ }
+ function test_converts_u_percent_encoded_values_if_win_ie() {
+ global $is_winIE;
+ $prev = $is_winIE;
+ $is_winIE = true;
+ $this->_run();
+ $is_winIE = $prev;
+ }
+ function _run() {
+ $input = $this->get_testdata("utf-8-u-urlencoded.txt");
+ $output = $this->get_testdata("utf-8-entitized.txt");
+ for ($i=0; $i<count($input); ++$i) {
+ $this->assertEquals($output[$i], funky_javascript_fix($input[$i]));
+ }
+ }
+}
+
+
+class Test_BalanceTags extends _WPFormattingTest {
+ function test_adds_missing_end_tags() {
+ $this->assertEquals("<b><i>abc</i></b>", balanceTags("<b><i>abc</b>", true));
+ }
+ function test_fixes_simple_bad_nesting() {
+ $this->assertEquals("<b><i>abc</i></b>", balanceTags("<b><i>abc</b></i>", true));
+ }
+}
+
+class Test_Zeroise extends _WPFormattingTest {
+ function test_pads_with_leading_zeroes() {
+ $this->assertEquals("00005", zeroise(5, 5));
+ }
+ function test_does_nothing_if_input_is_already_longer() {
+ $this->assertEquals("5000000", zeroise(5000000, 2));
+ }
+}
+
+class Test_Backslashit extends _WPFormattingTest {
+ function test_backslashes_alphas() {
+ $this->assertEquals("\\a943\\b\\c", backslashit("a943bc"));
+ }
+ function test_double_backslashes_leading_numbers() {
+ $this->assertEquals("\\\\95", backslashit("95"));
+ }
+}
+
+class Test_Untrailingslashit extends _WPFormattingTest {
+ function test_removes_trailing_slashes() {
+ $this->assertEquals("a", untrailingslashit("a/"));
+ $this->assertEquals("a", untrailingslashit("a////"));
+ }
+}
+
+class Test_Trailingslashit extends _WPFormattingTest {
+ function test_adds_trailing_slash() {
+ $this->assertEquals("a/", trailingslashit("a"));
+ }
+ function test_does_not_add_trailing_slash_if_one_exists() {
+ $this->assertEquals("a/", trailingslashit("a/"));
+ }
+}
+
+class Test_Is_Email extends _WPFormattingTest {
+ function test_returns_true_if_given_a_valid_email_address() {
+ $data = array(
+ "bob@example.com",
+ '"Bob Johnson" <bob@example.com>',
+ "phil@example.info",
+ "ace@204.32.222.14",
+ "kevin@many.subdomains.make.a.happy.man.edu"
+ );
+ foreach ( $data as $datum ) {
+ $this->assertEquals( $datum, is_email($datum), $datum );
+ }
+ }
+ // TODO: make up some more useful test data :)
+ function test_returns_false_if_given_an_invalid_email_address() {
+ $data = array(
+ "khaaaaaaaaaaaaaaan!",
+ 'http://bob.example.com/',
+ "sif i'd give u it, spamer!1",
+ "com.exampleNOSPAMbob",
+ "bob@your mom"
+ );
+ foreach ($data as $datum) {
+ $this->assertFalse(is_email($datum), $datum);
+ }
+ }
+}
+
+/*
+Decodes text in RFC2047 "Q"-encoding, e.g.
+
+ =?iso-8859-1?q?this=20is=20some=20text?=
+*/
+class Test_WP_ISO_Descrambler extends _WPFormattingTest {
+ function test_decodes_iso_8859_1_rfc2047_q_encoding() {
+ $this->assertEquals("this is some text", wp_iso_descrambler("=?iso-8859-1?q?this=20is=20some=20text?="));
+ }
+}
+
+class Test_Ent2NCR extends _WPFormattingTest {
+ function test_converts_named_entities_to_numeric_character_references() {
+ $data = $this->get_testdata("entities.txt");
+ foreach ($data as $datum) {
+ $parts = explode("|", $datum);
+ $name = "&" . trim($parts[0]) . ";";
+ $ncr = trim($parts[1]);
+ $this->assertEquals("&#".$ncr.";", ent2ncr($name), $name);
+ }
+ }
+}
+
+?>
</ins><span class="cx">Property changes on: wp-testcase/jacob/TestFormatting.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_admin_includes_pluginphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_admin_includes_plugin.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_admin_includes_templatephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_admin_includes_template.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_admin_includes_themephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_admin_includes_theme.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_cronphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_cron.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_cron.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_cron.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,301 +1,301 @@
</span><del>-<?php
-// test the cron scheduling functions
-
-class WPTestCronScheduling extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-        
-        function test_wp_get_schedule_empty() {
-                // nothing scheduled
-                $hook = rand_str();
-                $this->assertFalse(wp_get_schedule($hook));
-        }
-
-        function test_schedule_event_single() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_single_event( $timestamp, $hook );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // it's a non recurring event
-                $this->assertEquals( '', wp_get_schedule($hook) );
-
-        }
-
-        function test_schedule_event_single_args() {
-                // schedule an event with arguments and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-                $args = array(rand_str());
-
-                wp_schedule_single_event( $timestamp, $hook, $args );
-                // this returns the timestamp only if we provide matching args
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this->assertEquals( false, wp_next_scheduled($hook) );
-                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                // it's a non recurring event
-                $this->assertEquals( '', wp_get_schedule($hook, $args) );
-        }
-
-        function test_schedule_event() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $recur = 'hourly';
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_event( $timestamp, $recur, $hook );
-                // it's scheduled for the right time
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
-                // it's a recurring event
-                $this->assertEquals( $recur, wp_get_schedule($hook) );
-        }
-
-        function test_schedule_event_args() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-                $recur = 'hourly';
-                $args = array(rand_str());
-
-                wp_schedule_event( $timestamp, 'hourly', $hook, $args );
-                // this returns the timestamp only if we provide matching args
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this->assertEquals( false, wp_next_scheduled($hook) );
-                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
-
-        }
-
-        function test_unschedule_event() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_single_event( $timestamp, $hook );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // now unschedule it and make sure it's gone
-                wp_unschedule_event( $timestamp, $hook );
-                $this->assertEquals( false, wp_next_scheduled($hook) );
-        }
-
-        function test_clear_schedule() {
-                $hook = rand_str();
-                $args = array(rand_str());
-
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-
-                // make sure they're returned by wp_next_scheduled()
-                $this->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array
-                wp_clear_scheduled_hook($hook, $args[0]);
-                $this->assertFalse( wp_next_scheduled($hook, $args) );
-        }
-
-        function test_clear_schedule_multiple_args() {
-                $hook = rand_str();
-                $args = array(rand_str(), rand_str());
-
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-
-                // make sure they're returned by wp_next_scheduled()
-                $this->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // note: wp_clear_scheduled_hook() used to expect args passed directly, rather than as an array pre WP 3.0
-                wp_clear_scheduled_hook($hook, $args[0], $args[1]);
-                $this->assertFalse( wp_next_scheduled($hook, $args) );
-        }
-
-        function test_clear_schedule_new_args() {
-                $this->knownWPBug(10468);
-                $hook = rand_str();
-                $args = array(rand_str());
-                $multi_hook = rand_str();
-                $multi_args = array(rand_str(), rand_str());
-                
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
-                wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
-                
-                // make sure they're returned by wp_next_scheduled()
-                $this->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // wp_clear_scheduled_hook() should take args as an array like the other functions.
-                wp_clear_scheduled_hook($hook, $args);
-                $this->assertFalse( wp_next_scheduled($hook, $args) );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // wp_clear_scheduled_hook() should take args as an array like the other functions and does from WP 3.0
-                wp_clear_scheduled_hook($multi_hook, $multi_args);
-                $this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
-                
-        }
-
-        function test_duplicate_event() {
-                $this->knownWPBug(6966);
-                // duplicate events close together should be skipped
-                $hook = rand_str();
-                $args = array(rand_str());
-                $ts1 = strtotime('+5 minutes');
-                $ts2 = strtotime('+3 minutes');
-                
-                // first one works
-                wp_schedule_single_event( $ts1, $hook, $args );
-                // second one is ignored
-                wp_schedule_single_event( $ts2, $hook, $args );
-                
-                // the next event should be at +5 minutes, not +3
-                $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
-        }
-
-        function test_not_duplicate_event() {
-                $this->knownWPBug(6966);
-                // duplicate events far apart should work normally
-                $hook = rand_str();
-                $args = array(rand_str());
-                $ts1 = strtotime('+30 minutes');
-                $ts2 = strtotime('+3 minutes');
-                
-                // first one works
-                wp_schedule_single_event( $ts1, $hook, $args );
-                // second works too
-                wp_schedule_single_event( $ts2, $hook, $args );
-                
-                // the next event should be at +5 minutes, not +3
-                $this->assertEquals( $ts2, wp_next_scheduled($hook, $args) );
-                wp_unschedule_event( $ts2, $hook, $args );
-                // following event should be there too
-                $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
-        }
-}
-
-/*
- * Disable the WP Cron running test for the moment as it kills the whole test suite.
- * TODO - Fix it to work with the new cron implementation in trunk
- *
-class WPTestCronRunning extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-        function _do_cron() {
-                // FIXME: wp-cron.php is difficult to test, could be wrapped in a function
-                $_GET['check'] = wp_hash('187425');
-                require(ABSPATH.'/wp-cron.php');
-        }
-
-        function test_run_schedule_single() {
-                // schedule an event, run it, and make sure the hook is called
-                $hook = rand_str();
-                $args = array(rand_str());
-                $timestamp = strtotime('-1 second');
-
-                // register a test action
-                $a = new MockAction();
-                add_action($hook, array(&$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_single_event( $timestamp, $hook, $args );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-
-                // run cron jobs
-                $this->_do_cron();
-
-                // our action should have been called once with the correct args
-                $this->assertEquals( 1, $a->get_call_count() );
-                $this->assertEquals( array($args), $a->get_args() );
-                
-                // it shouldn't appear in the schedule anymore
-                $this->assertFalse( wp_next_scheduled($hook, $args) );
-
-        }
-        
-        function test_run_schedule_recurring() {
-                // schedule a recurring event, run it, and make sure the hook is called
-                $hook = rand_str();
-                $args = array(rand_str());
-                $timestamp = strtotime('-1 second');
-                $recur = 'hourly';
-
-                // register a test action
-                $a = new MockAction();
-                add_action($hook, array(&$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_event( $timestamp, $recur, $hook, $args );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
-
-                // run cron jobs
-                $this->_do_cron();
-
-                // our action should have been called once with the correct args
-                $this->assertEquals( 1, $a->get_call_count() );
-                $this->assertEquals( array($args), $a->get_args() );
-                
-                // it should appear in the schedule to run again in an hour's time
-                $this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
-
-        }
-}
-*/
-?>
</del><ins>+<?php
+// test the cron scheduling functions
+
+class WPTestCronScheduling extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+        
+        function test_wp_get_schedule_empty() {
+                // nothing scheduled
+                $hook = rand_str();
+                $this->assertFalse(wp_get_schedule($hook));
+        }
+
+        function test_schedule_event_single() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_single_event( $timestamp, $hook );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // it's a non recurring event
+                $this->assertEquals( '', wp_get_schedule($hook) );
+
+        }
+
+        function test_schedule_event_single_args() {
+                // schedule an event with arguments and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+                $args = array(rand_str());
+
+                wp_schedule_single_event( $timestamp, $hook, $args );
+                // this returns the timestamp only if we provide matching args
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this->assertEquals( false, wp_next_scheduled($hook) );
+                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                // it's a non recurring event
+                $this->assertEquals( '', wp_get_schedule($hook, $args) );
+        }
+
+        function test_schedule_event() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $recur = 'hourly';
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_event( $timestamp, $recur, $hook );
+                // it's scheduled for the right time
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+                // it's a recurring event
+                $this->assertEquals( $recur, wp_get_schedule($hook) );
+        }
+
+        function test_schedule_event_args() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+                $recur = 'hourly';
+                $args = array(rand_str());
+
+                wp_schedule_event( $timestamp, 'hourly', $hook, $args );
+                // this returns the timestamp only if we provide matching args
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this->assertEquals( false, wp_next_scheduled($hook) );
+                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+        }
+
+        function test_unschedule_event() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_single_event( $timestamp, $hook );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // now unschedule it and make sure it's gone
+                wp_unschedule_event( $timestamp, $hook );
+                $this->assertEquals( false, wp_next_scheduled($hook) );
+        }
+
+        function test_clear_schedule() {
+                $hook = rand_str();
+                $args = array(rand_str());
+
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+                // make sure they're returned by wp_next_scheduled()
+                $this->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array
+                wp_clear_scheduled_hook($hook, $args[0]);
+                $this->assertFalse( wp_next_scheduled($hook, $args) );
+        }
+
+        function test_clear_schedule_multiple_args() {
+                $hook = rand_str();
+                $args = array(rand_str(), rand_str());
+
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+                // make sure they're returned by wp_next_scheduled()
+                $this->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // note: wp_clear_scheduled_hook() used to expect args passed directly, rather than as an array pre WP 3.0
+                wp_clear_scheduled_hook($hook, $args[0], $args[1]);
+                $this->assertFalse( wp_next_scheduled($hook, $args) );
+        }
+
+        function test_clear_schedule_new_args() {
+                $this->knownWPBug(10468);
+                $hook = rand_str();
+                $args = array(rand_str());
+                $multi_hook = rand_str();
+                $multi_args = array(rand_str(), rand_str());
+                
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
+                wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
+                
+                // make sure they're returned by wp_next_scheduled()
+                $this->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // wp_clear_scheduled_hook() should take args as an array like the other functions.
+                wp_clear_scheduled_hook($hook, $args);
+                $this->assertFalse( wp_next_scheduled($hook, $args) );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // wp_clear_scheduled_hook() should take args as an array like the other functions and does from WP 3.0
+                wp_clear_scheduled_hook($multi_hook, $multi_args);
+                $this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
+                
+        }
+
+        function test_duplicate_event() {
+                $this->knownWPBug(6966);
+                // duplicate events close together should be skipped
+                $hook = rand_str();
+                $args = array(rand_str());
+                $ts1 = strtotime('+5 minutes');
+                $ts2 = strtotime('+3 minutes');
+                
+                // first one works
+                wp_schedule_single_event( $ts1, $hook, $args );
+                // second one is ignored
+                wp_schedule_single_event( $ts2, $hook, $args );
+                
+                // the next event should be at +5 minutes, not +3
+                $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
+        }
+
+        function test_not_duplicate_event() {
+                $this->knownWPBug(6966);
+                // duplicate events far apart should work normally
+                $hook = rand_str();
+                $args = array(rand_str());
+                $ts1 = strtotime('+30 minutes');
+                $ts2 = strtotime('+3 minutes');
+                
+                // first one works
+                wp_schedule_single_event( $ts1, $hook, $args );
+                // second works too
+                wp_schedule_single_event( $ts2, $hook, $args );
+                
+                // the next event should be at +5 minutes, not +3
+                $this->assertEquals( $ts2, wp_next_scheduled($hook, $args) );
+                wp_unschedule_event( $ts2, $hook, $args );
+                // following event should be there too
+                $this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
+        }
+}
+
+/*
+ * Disable the WP Cron running test for the moment as it kills the whole test suite.
+ * TODO - Fix it to work with the new cron implementation in trunk
+ *
+class WPTestCronRunning extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+        function _do_cron() {
+                // FIXME: wp-cron.php is difficult to test, could be wrapped in a function
+                $_GET['check'] = wp_hash('187425');
+                require(ABSPATH.'/wp-cron.php');
+        }
+
+        function test_run_schedule_single() {
+                // schedule an event, run it, and make sure the hook is called
+                $hook = rand_str();
+                $args = array(rand_str());
+                $timestamp = strtotime('-1 second');
+
+                // register a test action
+                $a = new MockAction();
+                add_action($hook, array(&$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_single_event( $timestamp, $hook, $args );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+
+                // run cron jobs
+                $this->_do_cron();
+
+                // our action should have been called once with the correct args
+                $this->assertEquals( 1, $a->get_call_count() );
+                $this->assertEquals( array($args), $a->get_args() );
+                
+                // it shouldn't appear in the schedule anymore
+                $this->assertFalse( wp_next_scheduled($hook, $args) );
+
+        }
+        
+        function test_run_schedule_recurring() {
+                // schedule a recurring event, run it, and make sure the hook is called
+                $hook = rand_str();
+                $args = array(rand_str());
+                $timestamp = strtotime('-1 second');
+                $recur = 'hourly';
+
+                // register a test action
+                $a = new MockAction();
+                add_action($hook, array(&$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_event( $timestamp, $recur, $hook, $args );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+                // run cron jobs
+                $this->_do_cron();
+
+                // our action should have been called once with the correct args
+                $this->assertEquals( 1, $a->get_call_count() );
+                $this->assertEquals( array($args), $a->get_args() );
+                
+                // it should appear in the schedule to run again in an hour's time
+                $this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
+
+        }
+}
+*/
+?>
</ins><span class="cx">Property changes on: wp-testcase/test_cron.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_filtersphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_filters.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_filters.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_filters.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,238 +1,238 @@
</span><del>-<?php
-
-// test do_action and related functions
-
-class WPTestFilters extends WPTestCase {
-
-        function test_simple_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter($tag, array(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // only one event occurred for the hook, with empty args
-                $this->assertEquals(1, $a->get_call_count());
-                // only our hook was called
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                $args = array_pop($a->get_args());
-                $this->assertEquals(array($val), $args);
-        }
-
-        function test_remove_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter($tag, array(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter($tag, array(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-        }
-        
-        function test_has_filter() {
-                        $tag = rand_str();
-                        $func = rand_str();
-                        
-                        $this->assertFalse( has_filter($tag, $func) );
-                        $this->assertFalse( has_filter($tag) );
-                        add_filter($tag, $func);
-                        $this->assertEquals( 10, has_filter($tag, $func) );
-                        $this->assertTrue( has_filter($tag) );
-                        remove_filter($tag, $func);
-                        $this->assertFalse( has_filter($tag, $func) );
-                        $this->assertFalse( has_filter($tag) );
-        }
-
-        // one tag with multiple filters
-        function test_multiple_filters() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                // add both filters to the hook
-                add_filter($tag, array(&$a1, 'filter'));
-                add_filter($tag, array(&$a2, 'filter'));
-
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // both filters called once each
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(1, $a2->get_call_count());
-        }
-
-        function test_filter_args_1() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-                $arg1 = rand_str();
-
-                add_filter($tag, array(&$a, 'filter'), 10, 2);
-                // call the filter with a single argument
-                $this->assertEquals($val, apply_filters($tag, $val, $arg1));
-
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($val, $arg1), array_pop($a->get_args()));
-        }
-
-        function test_filter_args_2() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-                $arg1 = rand_str();
-                $arg2 = rand_str();
-
-                // a1 accepts two arguments, a2 doesn't
-                add_filter($tag, array(&$a1, 'filter'), 10, 3);
-                add_filter($tag, array(&$a2, 'filter'));
-                // call the filter with two arguments
-                $this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
-
-                // a1 should be called with both args
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(array($val, $arg1, $arg2), array_pop($a1->get_args()));
-
-                // a2 should be called with one only
-                $this->assertEquals(1, $a2->get_call_count());
-                $this->assertEquals(array($val), array_pop($a2->get_args()));
-        }
-
-        function test_filter_priority() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                // make two filters with different priorities
-                add_filter($tag, array(&$a, 'filter'), 10);
-                add_filter($tag, array(&$a, 'filter2'), 9);
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // there should be two events, one per filter
-                $this->assertEquals(2, $a->get_call_count());
-
-                $expected = array (
-                        // filter2 is called first because it has priority 9
-                        array (
-                                'filter' => 'filter2',
-                                'tag' => $tag,
-                                'args' => array($val)
-                        ),
-                        // filter 1 is called second
-                        array (
-                                'filter' => 'filter',
-                                'tag' => $tag,
-                                'args' => array($val)
-                        ),
-                );
-
-                $this->assertEquals($expected, $a->get_events());
-        }
-
-        function test_all_filter() {
-                $a = new MockAction();
-                $tag1 = rand_str();
-                $tag2 = rand_str();
-                $val = rand_str();
-
-                // add an 'all' filter
-                add_filter('all', array(&$a, 'filterall'));
-                // do some filters
-                $this->assertEquals($val, apply_filters($tag1, $val));
-                $this->assertEquals($val, apply_filters($tag2, $val));
-                $this->assertEquals($val, apply_filters($tag1, $val));
-                $this->assertEquals($val, apply_filters($tag1, $val));
-
-                // our filter should have been called once for each apply_filters call
-                $this->assertEquals(4, $a->get_call_count());
-                // the right hooks should have been called in order
-                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
-
-                remove_filter('all', array(&$a, 'filterall'));
-                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
-
-        }
-
-        function test_remove_all_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter('all', array(&$a, 'filterall'));
-                $this->assertTrue( has_filter('all') );
-                $this->assertEquals( 10, has_filter('all', array(&$a, 'filterall')) );
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter('all', array(&$a, 'filterall'));
-                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
-                $this->assertFalse( has_filter('all') );
-                $this->assertEquals($val, apply_filters($tag, $val));
-                // call cound should remain at 1
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-        }
-
-        function test_filter_ref_array() {
-                $this->knownWPBug(9886);
-                $obj = new stdClass();
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'filter'));
-
-                apply_filters_ref_array($tag, array(&$obj));
-
-                $args = $a->get_args();
-                $this->assertSame($args[0][0], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][0]->foo) );
-        }
-
-        function test_filter_ref_array_result() {
-                $this->knownWPBug(12723);
-                $obj = new stdClass();
-                $a = new MockAction();
-                $b = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'filter_append'), 10, 2);
-                add_action($tag, array(&$b, 'filter_append'), 10, 2);
-                
-                $result = apply_filters_ref_array($tag, array('string', &$obj));
-
-                $this->assertEquals($result, 'string_append_append');
-                
-                $args = $a->get_args();
-                $this->assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][1]->foo) );
-
-                $args = $b->get_args();
-                $this->assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][1]->foo) );
-                
-        }
-}
-
-?>
</del><ins>+<?php
+
+// test do_action and related functions
+
+class WPTestFilters extends WPTestCase {
+
+        function test_simple_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter($tag, array(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // only one event occurred for the hook, with empty args
+                $this->assertEquals(1, $a->get_call_count());
+                // only our hook was called
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                $args = array_pop($a->get_args());
+                $this->assertEquals(array($val), $args);
+        }
+
+        function test_remove_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter($tag, array(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter($tag, array(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+        }
+        
+        function test_has_filter() {
+                        $tag = rand_str();
+                        $func = rand_str();
+                        
+                        $this->assertFalse( has_filter($tag, $func) );
+                        $this->assertFalse( has_filter($tag) );
+                        add_filter($tag, $func);
+                        $this->assertEquals( 10, has_filter($tag, $func) );
+                        $this->assertTrue( has_filter($tag) );
+                        remove_filter($tag, $func);
+                        $this->assertFalse( has_filter($tag, $func) );
+                        $this->assertFalse( has_filter($tag) );
+        }
+
+        // one tag with multiple filters
+        function test_multiple_filters() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                // add both filters to the hook
+                add_filter($tag, array(&$a1, 'filter'));
+                add_filter($tag, array(&$a2, 'filter'));
+
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // both filters called once each
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(1, $a2->get_call_count());
+        }
+
+        function test_filter_args_1() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+                $arg1 = rand_str();
+
+                add_filter($tag, array(&$a, 'filter'), 10, 2);
+                // call the filter with a single argument
+                $this->assertEquals($val, apply_filters($tag, $val, $arg1));
+
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($val, $arg1), array_pop($a->get_args()));
+        }
+
+        function test_filter_args_2() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+                $arg1 = rand_str();
+                $arg2 = rand_str();
+
+                // a1 accepts two arguments, a2 doesn't
+                add_filter($tag, array(&$a1, 'filter'), 10, 3);
+                add_filter($tag, array(&$a2, 'filter'));
+                // call the filter with two arguments
+                $this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
+
+                // a1 should be called with both args
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(array($val, $arg1, $arg2), array_pop($a1->get_args()));
+
+                // a2 should be called with one only
+                $this->assertEquals(1, $a2->get_call_count());
+                $this->assertEquals(array($val), array_pop($a2->get_args()));
+        }
+
+        function test_filter_priority() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                // make two filters with different priorities
+                add_filter($tag, array(&$a, 'filter'), 10);
+                add_filter($tag, array(&$a, 'filter2'), 9);
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // there should be two events, one per filter
+                $this->assertEquals(2, $a->get_call_count());
+
+                $expected = array (
+                        // filter2 is called first because it has priority 9
+                        array (
+                                'filter' => 'filter2',
+                                'tag' => $tag,
+                                'args' => array($val)
+                        ),
+                        // filter 1 is called second
+                        array (
+                                'filter' => 'filter',
+                                'tag' => $tag,
+                                'args' => array($val)
+                        ),
+                );
+
+                $this->assertEquals($expected, $a->get_events());
+        }
+
+        function test_all_filter() {
+                $a = new MockAction();
+                $tag1 = rand_str();
+                $tag2 = rand_str();
+                $val = rand_str();
+
+                // add an 'all' filter
+                add_filter('all', array(&$a, 'filterall'));
+                // do some filters
+                $this->assertEquals($val, apply_filters($tag1, $val));
+                $this->assertEquals($val, apply_filters($tag2, $val));
+                $this->assertEquals($val, apply_filters($tag1, $val));
+                $this->assertEquals($val, apply_filters($tag1, $val));
+
+                // our filter should have been called once for each apply_filters call
+                $this->assertEquals(4, $a->get_call_count());
+                // the right hooks should have been called in order
+                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
+
+                remove_filter('all', array(&$a, 'filterall'));
+                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
+
+        }
+
+        function test_remove_all_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter('all', array(&$a, 'filterall'));
+                $this->assertTrue( has_filter('all') );
+                $this->assertEquals( 10, has_filter('all', array(&$a, 'filterall')) );
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter('all', array(&$a, 'filterall'));
+                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
+                $this->assertFalse( has_filter('all') );
+                $this->assertEquals($val, apply_filters($tag, $val));
+                // call cound should remain at 1
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+        }
+
+        function test_filter_ref_array() {
+                $this->knownWPBug(9886);
+                $obj = new stdClass();
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'filter'));
+
+                apply_filters_ref_array($tag, array(&$obj));
+
+                $args = $a->get_args();
+                $this->assertSame($args[0][0], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][0]->foo) );
+        }
+
+        function test_filter_ref_array_result() {
+                $this->knownWPBug(12723);
+                $obj = new stdClass();
+                $a = new MockAction();
+                $b = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'filter_append'), 10, 2);
+                add_action($tag, array(&$b, 'filter_append'), 10, 2);
+                
+                $result = apply_filters_ref_array($tag, array('string', &$obj));
+
+                $this->assertEquals($result, 'string_append_append');
+                
+                $args = $a->get_args();
+                $this->assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][1]->foo) );
+
+                $args = $b->get_args();
+                $this->assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][1]->foo) );
+                
+        }
+}
+
+?>
</ins><span class="cx">Property changes on: wp-testcase/test_filters.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_httpphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_http.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_http.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_http.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,157 +1,157 @@
</span><del>-<?php
-// Note, When running these tests, remember that some things are done differently based on safe_mode
-// You can run the test in safe_mode like such: php -d safe_mode=on wp-test.php - you may also need `-d safe_mode_gid=1` to relax the safe_mode checks to allow inclusion of PEAR.
-// The WP_HTTP tests require a class-http.php file of r17550 or later.
-class _WPHTTP extends WPTestCase {
-        var $redirection_script = 'http://tools.dd32.id.au/redirect/'; // You can use your own version here, You can find it in wp-testdata/WPHTTP-testcase-redirection-script.php
-
-        function SetUp() {
-
-                if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
-                        $this->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
-                        return;
-                }
-
-                $class = "WP_HTTP_" . $this->transport;
-                if ( !call_user_func( array($class, 'test') ) ) {
-                        $this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
-                }
-
-                // Disable all transports aside from this one.
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( "use_{$t}_transport", '__return_false' ); // Just strip them all
-                        if ( $t != $this->transport )
-                                add_filter( "use_{$t}_transport", '__return_false' ); // and add it back if need be..
-                }
-        }
-
-        function tearDown() {
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( "use_{$t}_transport", '__return_false' );
-                }
-        }
-
-        function test_redirect_on_301() {        
-                // 5 : 5 & 301
-                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) );
-                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_redirect_on_302() {        
-                // 5 : 5 & 302
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 5) );
-                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-        
-        function test_redirect_on_301_no_redirect() {
-                $this->knownWPBug(16855);
-                // 5 > 0 & 301
-                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 0) );
-                $this->assertEquals(301, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_redirect_on_302_no_redirect() {
-                $this->knownWPBug(16855);
-                // 5 > 0 & 302
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
-                $this->assertEquals(302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_redirections_equal() {        
-                // 5 - 5
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5) );
-                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_no_head_redirections() {
-                // No redirections on HEAD request:
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 1, array('method' => 'HEAD') );
-                $this->assertEquals( 302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_redirect_on_head() {
-                $this->knownWPBug(16855);
-                // Redirections on HEAD request when Requested
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5, 'method' => 'HEAD') );
-                $this->assertEquals( 200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
-        }
-
-        function test_redirections_greater() {
-                // 10 > 5
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) );
-                $this->assertTrue( is_wp_error($res), print_r($res, true) );
-        }
-
-        function test_redirections_greater_edgecase() {
-                // 6 > 5 (close edgecase)
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) );
-                $this->assertTrue( is_wp_error($res) );
-        }
-
-        function test_redirections_less_edgecase() {
-                // 4 < 5 (close edgecase)
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 4, array('redirection' => 5) );
-                $this->assertFalse( is_wp_error($res) );
-        }
-
-        function test_redirections_zero_redirections_specified() {
-                $this->knownWPBug(16855);
-                // 0 redirections asked for, Should return the document?
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
-                $this->assertEquals( 302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );                
-        }
-        
-        function test_location_header_on_200() {
-                //$this->knownWPBug(16889);
-                // Is this valid? Streams, cURL and therefor, PHP Extension (ie. all PHP Internal) follow redirects on all status codes, currently all of WP_HTTP follows this template.
-                
-                // Do not redirect on non 3xx status codes
-                //$res = wp_remote_request( $this->redirection_script . '?200-location=true' ); // Prints PASS on initial load, FAIL if the client follows the specified redirection
-                //$this->assertEquals( 'PASS', $res['body']);
-        }
-        
-        function test_send_headers() {
-                $this->knownWPBug(11888);
-                // Test that the headers sent are recieved by the server
-                $headers = array('test1' => 'test', 'test2' => 0, 'test3' => '');
-                $res = wp_remote_request( $this->redirection_script . '?header-check', array('headers' => $headers) );
-
-                $headers = array();
-                foreach ( explode("\n", $res['body']) as $key => $value ) {
-                        if ( empty($value) )
-                                continue;
-                        $parts = explode(':', $value,2);
-                        unset($heaers[$key]);
-                        $headers[ $parts[0] ] = $parts[1];
-                }
-
-                $this->assertTrue( isset($headers['test1']) && 'test' == $headers['test1'] );
-                $this->assertTrue( isset($headers['test2']) && '0' === $headers['test2'] );
-                // cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value.
-                // Should it be that empty headers with empty values are NOT sent?
-                //$this->assertTrue( isset($headers['test3']) && '' === $headers['test3'] );
-        }
-        
-        function test_file_stream() {
-                $url = 'http://unit-tests.svn.wordpress.org/wp-testdata/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
-                $size = 87348;
-                $res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
-
-                $this->assertEquals( '', $res['body'] ); // The body should be empty.
-                $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
-                $this->assertEquals( $size, filesize($res['filename']) ); // Check that the file is written to disk correctly without any extra characters
-
-                unlink($res['filename']); // Remove the temporary file
-        }
-}
-
-// Stubs to test each transport
-class WPHTTP_curl extends _WPHTTP {
-        var $transport = 'curl';
-}
-class WPHTTP_streams extends _WPHTTP {
-        var $transport = 'streams';
-}
-class WPHTTP_fsockopen extends _WPHTTP {
-        var $transport = 'fsockopen';
</del><ins>+<?php
+// Note, When running these tests, remember that some things are done differently based on safe_mode
+// You can run the test in safe_mode like such: php -d safe_mode=on wp-test.php - you may also need `-d safe_mode_gid=1` to relax the safe_mode checks to allow inclusion of PEAR.
+// The WP_HTTP tests require a class-http.php file of r17550 or later.
+class _WPHTTP extends WPTestCase {
+        var $redirection_script = 'http://tools.dd32.id.au/redirect/'; // You can use your own version here, You can find it in wp-testdata/WPHTTP-testcase-redirection-script.php
+
+        function SetUp() {
+
+                if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
+                        $this->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
+                        return;
+                }
+
+                $class = "WP_HTTP_" . $this->transport;
+                if ( !call_user_func( array($class, 'test') ) ) {
+                        $this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
+                }
+
+                // Disable all transports aside from this one.
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( "use_{$t}_transport", '__return_false' ); // Just strip them all
+                        if ( $t != $this->transport )
+                                add_filter( "use_{$t}_transport", '__return_false' ); // and add it back if need be..
+                }
+        }
+
+        function tearDown() {
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( "use_{$t}_transport", '__return_false' );
+                }
+        }
+
+        function test_redirect_on_301() {        
+                // 5 : 5 & 301
+                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) );
+                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_redirect_on_302() {        
+                // 5 : 5 & 302
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 5) );
+                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+        
+        function test_redirect_on_301_no_redirect() {
+                $this->knownWPBug(16855);
+                // 5 > 0 & 301
+                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 0) );
+                $this->assertEquals(301, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_redirect_on_302_no_redirect() {
+                $this->knownWPBug(16855);
+                // 5 > 0 & 302
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+                $this->assertEquals(302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_redirections_equal() {        
+                // 5 - 5
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5) );
+                $this->assertEquals(200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_no_head_redirections() {
+                // No redirections on HEAD request:
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 1, array('method' => 'HEAD') );
+                $this->assertEquals( 302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_redirect_on_head() {
+                $this->knownWPBug(16855);
+                // Redirections on HEAD request when Requested
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5, 'method' => 'HEAD') );
+                $this->assertEquals( 200, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );
+        }
+
+        function test_redirections_greater() {
+                // 10 > 5
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) );
+                $this->assertTrue( is_wp_error($res), print_r($res, true) );
+        }
+
+        function test_redirections_greater_edgecase() {
+                // 6 > 5 (close edgecase)
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) );
+                $this->assertTrue( is_wp_error($res) );
+        }
+
+        function test_redirections_less_edgecase() {
+                // 4 < 5 (close edgecase)
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 4, array('redirection' => 5) );
+                $this->assertFalse( is_wp_error($res) );
+        }
+
+        function test_redirections_zero_redirections_specified() {
+                $this->knownWPBug(16855);
+                // 0 redirections asked for, Should return the document?
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+                $this->assertEquals( 302, (is_wp_error($res) ? 0 : (int)$res['response']['code']) );                
+        }
+        
+        function test_location_header_on_200() {
+                //$this->knownWPBug(16889);
+                // Is this valid? Streams, cURL and therefor, PHP Extension (ie. all PHP Internal) follow redirects on all status codes, currently all of WP_HTTP follows this template.
+                
+                // Do not redirect on non 3xx status codes
+                //$res = wp_remote_request( $this->redirection_script . '?200-location=true' ); // Prints PASS on initial load, FAIL if the client follows the specified redirection
+                //$this->assertEquals( 'PASS', $res['body']);
+        }
+        
+        function test_send_headers() {
+                $this->knownWPBug(11888);
+                // Test that the headers sent are recieved by the server
+                $headers = array('test1' => 'test', 'test2' => 0, 'test3' => '');
+                $res = wp_remote_request( $this->redirection_script . '?header-check', array('headers' => $headers) );
+
+                $headers = array();
+                foreach ( explode("\n", $res['body']) as $key => $value ) {
+                        if ( empty($value) )
+                                continue;
+                        $parts = explode(':', $value,2);
+                        unset($heaers[$key]);
+                        $headers[ $parts[0] ] = $parts[1];
+                }
+
+                $this->assertTrue( isset($headers['test1']) && 'test' == $headers['test1'] );
+                $this->assertTrue( isset($headers['test2']) && '0' === $headers['test2'] );
+                // cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value.
+                // Should it be that empty headers with empty values are NOT sent?
+                //$this->assertTrue( isset($headers['test3']) && '' === $headers['test3'] );
+        }
+        
+        function test_file_stream() {
+                $url = 'http://unit-tests.svn.wordpress.org/wp-testdata/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
+                $size = 87348;
+                $res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
+
+                $this->assertEquals( '', $res['body'] ); // The body should be empty.
+                $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
+                $this->assertEquals( $size, filesize($res['filename']) ); // Check that the file is written to disk correctly without any extra characters
+
+                unlink($res['filename']); // Remove the temporary file
+        }
+}
+
+// Stubs to test each transport
+class WPHTTP_curl extends _WPHTTP {
+        var $transport = 'curl';
+}
+class WPHTTP_streams extends _WPHTTP {
+        var $transport = 'streams';
+}
+class WPHTTP_fsockopen extends _WPHTTP {
+        var $transport = 'fsockopen';
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: wp-testcase/test_http.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_imagephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_image.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_import_wpphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_import_wp.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_import_wp.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_import_wp.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,486 +1,486 @@
</span><del>-<?php
-
-#include_once(DIR_TESTROOT.'/wp-testlib/wp-profiler.php');
-
-// need to include the importer as an external, so path may need to change...
-
-// _nuke_main_tables style function on tearDown? (Should this be part of _WPEmptyBlog tearDown?)
-
-class WXRParserTest extends WPTestCase {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-                        
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );                
-
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-        
-        function test_malformed_wxr() {
-                $file = DIR_TESTDATA . '/export/malformed.xml';
-        
-                // regex based parser cannot detect malformed XML
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
-                        $parser = new $p;
-                        $result = $parser->parse($file);
-                        $this->assertTrue( is_wp_error( $result ) );
-                        $this->assertEquals( 'There was an error when reading this WXR file', $result->get_error_message() );        
-                }        
-        }        
-
-        function test_invalid_wxr() {
-                $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml';
-                $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml';
-        
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        foreach ( array( $f1, $f2 ) as $file ) {
-                                $parser = new $p;
-                                $result = $parser->parse( $file );                                
-                                $this->assertTrue( is_wp_error( $result ) );
-                                $this->assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );        
-                        }
-                }                        
-        }
-        
-        function test_wxr_version_1_1() {
-                $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml';
-                        
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        $message = $p . ' failed';
-                        $parser = new $p;
-                        $result = $parser->parse( $file );        
-                        
-                        $this->assertTrue( is_array( $result ), $message );                        
-                        $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
-                        $this->assertEquals( array(
-                                'author_id' => 2,
-                                'author_login' => 'john',
-                                'author_email' => 'johndoe@example.org',
-                                'author_display_name' => 'John Doe',
-                                'author_first_name' => 'John',
-                                'author_last_name' => 'Doe'
-                        ), $result['authors']['john'], $message );
-                        $this->assertEquals( array(
-                                'term_id' => 3,
-                                'category_nicename' => 'alpha',
-                                'category_parent' => '',
-                                'cat_name' => 'alpha',
-                                'category_description' => 'The alpha category'                        
-                        ), $result['categories'][0], $message );
-                        $this->assertEquals( array(
-                                'term_id' => 22,
-                                'tag_slug' => 'clippable',
-                                'tag_name' => 'Clippable',
-                                'tag_description' => 'The Clippable post_tag'                
-                        ), $result['tags'][0], $message );
-                        $this->assertEquals( array(
-                                'term_id' => 40,
-                                'term_taxonomy' => 'post_tax',
-                                'slug' => 'bieup',
-                                'term_parent' => '',                                
-                                'term_name' => 'bieup',
-                                'term_description' => 'The bieup post_tax'                
-                        ), $result['terms'][0], $message );                                        
-
-                        $this->assertEquals( 2, count($result['posts']), $message );
-                        $this->assertEquals( 19, count($result['posts'][0]), $message );
-                        $this->assertEquals( 18, count($result['posts'][1]), $message );
-                        $this->assertEquals( array(
-                                array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
-                                array( 'name' => 'Clippable', 'slug' => 'clippable', 'domain' => 'post_tag' ),
-                                array( 'name' => 'bieup', 'slug' => 'bieup', 'domain' => 'post_tax' )
-                        ), $result['posts'][0]['terms'], $message );
-                        $this->assertEquals( array(
-                                array( 'key' => '_wp_page_template', 'value' => 'default' )
-                        ), $result['posts'][1]['postmeta'], $message );        
-                }
-        }
-        
-        function test_wxr_version_1_0() {
-                $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml';
-                
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        $message = $p . ' failed';
-                        $parser = new $p;
-                        $result = $parser->parse( $file );
-                        
-                        $this->assertTrue( is_array( $result ), $message );                        
-                        $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
-                        $this->assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
-                        $this->assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
-                        $this->assertEquals( $result['categories'][0]['category_parent'], '', $message );
-                        $this->assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
-                        $this->assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
-                        $this->assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );        
-
-                        $this->assertEquals( 6, count($result['posts']), $message );
-                        $this->assertEquals( 19, count($result['posts'][0]), $message );
-                        $this->assertEquals( 18, count($result['posts'][1]), $message );
-
-                        $this->assertEquals( array(
-                                array( 'name' => 'Uncategorized', 'slug' => 'uncategorized', 'domain' => 'category' )
-                        ), $result['posts'][0]['terms'], $message );
-                        $this->assertEquals( array(
-                                array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
-                                array( 'name' => 'news', 'slug' => 'news', 'domain' => 'tag' ),
-                                array( 'name' => 'roar', 'slug' => 'roar', 'domain' => 'tag' )
-                        ), $result['posts'][2]['terms'], $message );
-                        $this->assertEquals( array(
-                                array( 'name' => 'chicken', 'slug' => 'chicken', 'domain' => 'tag' ),
-                                array( 'name' => 'child', 'slug' => 'child', 'domain' => 'category' ),
-                                array( 'name' => 'face', 'slug' => 'face', 'domain' => 'tag' )
-                        ), $result['posts'][3]['terms'], $message );
-
-                        $this->assertEquals( array(
-                                array( 'key' => '_wp_page_template', 'value' => 'default' )
-                        ), $result['posts'][1]['postmeta'], $message );
-                }
-        }
-        
-        // tags in CDATA #11574
-}
-
-class WPImportTest extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-                        
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-                        
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-
-                global $wpdb;
-                // crude but effective: make sure there's no residual data in the main tables
-                foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
-                        $wpdb->query("DELETE FROM {$wpdb->$table}");
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                $this->_delete_all_posts();
-
-                if ( $user = get_user_by( 'login', 'admin' ) )
-                        wp_delete_user( $user->ID );
-                if ( $user = get_user_by( 'login', 'editor' ) )
-                        wp_delete_user( $user->ID );
-                if ( $user = get_user_by( 'login', 'author' ) )
-                        wp_delete_user( $user->ID );
-        }
-        
-        function test_small_import() {
-                global $wpdb;
-
-                $authors = array( 'admin' => false, 'editor' => false, 'author' => false );        
-                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-
-                // ensure that authors were imported correctly
-                $user_count = count_users();
-                $this->assertEquals( 3, $user_count['total_users'] );
-                $admin = get_user_by( 'login', 'admin' );
-                $this->assertEquals( 'admin', $admin->user_login );
-                $this->assertEquals( 'local@host.null', $admin->user_email );
-                $editor = get_user_by( 'login', 'editor' );
-                $this->assertEquals( 'editor', $editor->user_login );
-                $this->assertEquals( 'editor@example.org', $editor->user_email );
-                $this->assertEquals( 'FirstName', $editor->user_firstname );
-                $this->assertEquals( 'LastName', $editor->user_lastname );
-                $author = get_user_by( 'login', 'author' );
-                $this->assertEquals( 'author', $author->user_login );
-                $this->assertEquals( 'author@example.org', $author->user_email );
-
-                // check that terms were imported correctly
-                $this->assertEquals( 30, wp_count_terms( 'category' ) );
-                $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
-                $foo = get_term_by( 'slug', 'foo', 'category' );
-                $this->assertEquals( 0, $foo->parent );
-                $bar = get_term_by( 'slug', 'bar', 'category' );
-                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
-                $this->assertEquals( $bar->term_id, $foo_bar->parent );
-
-                // check that posts/pages were imported correctly
-                $post_count = wp_count_posts( 'post' );
-                $this->assertEquals( 5, $post_count->publish );
-                $this->assertEquals( 1, $post_count->private );
-                $page_count = wp_count_posts( 'page' );
-                $this->assertEquals( 4, $page_count->publish );
-                $this->assertEquals( 1, $page_count->draft );
-                $comment_count = wp_count_comments();
-                $this->assertEquals( 1, $comment_count->total_comments );
-
-                $posts = get_posts( array( 'numberposts' => 20, 'post_type' => 'any', 'post_status' => 'any', 'orderby' => 'ID' ) );
-                $this->assertEquals( 11, count($posts) );
-
-                $post = $posts[0];
-                $this->assertEquals( 'Many Categories', $post->post_title );
-                $this->assertEquals( 'many-categories', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID );
-                $this->assertEquals( 27, count($cats) );
-
-                $post = $posts[1];
-                $this->assertEquals( 'Non-standard post format', $post->post_title );
-                $this->assertEquals( 'non-standard-post-format', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID );
-                $this->assertEquals( 1, count($cats) );
-                $this->assertTrue( has_post_format( 'aside', $post->ID ) );
-
-                $post = $posts[2];
-                $this->assertEquals( 'Top-level Foo', $post->post_title );
-                $this->assertEquals( 'top-level-foo', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
-                $this->assertEquals( 1, count($cats) );
-                $this->assertEquals( 'foo', $cats[0]->slug );
-
-                $post = $posts[3];
-                $this->assertEquals( 'Foo-child', $post->post_title );
-                $this->assertEquals( 'foo-child', $post->post_name );
-                $this->assertEquals( $editor->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
-                $this->assertEquals( 1, count($cats) );
-                $this->assertEquals( 'foo-bar', $cats[0]->slug );
-
-                $post = $posts[4];
-                $this->assertEquals( 'Private Post', $post->post_title );
-                $this->assertEquals( 'private-post', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'private', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID );
-                $this->assertEquals( 1, count($cats) );
-                $tags = wp_get_post_tags( $post->ID );
-                $this->assertEquals( 3, count($tags) );
-                $this->assertEquals( 'tag1', $tags[0]->slug );
-                $this->assertEquals( 'tag2', $tags[1]->slug );
-                $this->assertEquals( 'tag3', $tags[2]->slug );
-
-                $post = $posts[5];
-                $this->assertEquals( '1-col page', $post->post_title );
-                $this->assertEquals( '1-col-page', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'page', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $this->assertEquals( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );
-
-                $post = $posts[6];
-                $this->assertEquals( 'Draft Page', $post->post_title );
-                $this->assertEquals( '', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'page', $post->post_type );
-                $this->assertEquals( 'draft', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
-
-                $post = $posts[7];
-                $this->assertEquals( 'Parent Page', $post->post_title );
-                $this->assertEquals( 'parent-page', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'page', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
-
-                $post = $posts[8];
-                $this->assertEquals( 'Child Page', $post->post_title );
-                $this->assertEquals( 'child-page', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'page', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( $posts[7]->ID, $post->post_parent );
-                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
-
-                $post = $posts[9];
-                $this->assertEquals( 'Sample Page', $post->post_title );
-                $this->assertEquals( 'sample-page', $post->post_name );
-                $this->assertEquals( $admin->ID, $post->post_author );
-                $this->assertEquals( 'page', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
-
-                $post = $posts[10];
-                $this->assertEquals( 'Hello world!', $post->post_title );
-                $this->assertEquals( 'hello-world', $post->post_name );
-                $this->assertEquals( $author->ID, $post->post_author );
-                $this->assertEquals( 'post', $post->post_type );
-                $this->assertEquals( 'publish', $post->post_status );
-                $this->assertEquals( 0, $post->post_parent );
-                $cats = wp_get_post_categories( $post->ID );
-                $this->assertEquals( 1, count($cats) );
-        }
-        
-        function test_double_import() {
-                $authors = array( 'admin' => false, 'editor' => false, 'author' => false );
-                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-
-                $user_count = count_users();
-                $this->assertEquals( 3, $user_count['total_users'] );
-                $admin = get_user_by( 'login', 'admin' );
-                $this->assertEquals( 'admin', $admin->user_login );
-                $this->assertEquals( 'local@host.null', $admin->user_email );
-                $editor = get_user_by( 'login', 'editor' );
-                $this->assertEquals( 'editor', $editor->user_login );
-                $this->assertEquals( 'editor@example.org', $editor->user_email );
-                $this->assertEquals( 'FirstName', $editor->user_firstname );
-                $this->assertEquals( 'LastName', $editor->user_lastname );
-                $author = get_user_by( 'login', 'author' );
-                $this->assertEquals( 'author', $author->user_login );
-                $this->assertEquals( 'author@example.org', $author->user_email );
-
-                $this->assertEquals( 30, wp_count_terms( 'category' ) );
-                $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
-                $foo = get_term_by( 'slug', 'foo', 'category' );
-                $this->assertEquals( 0, $foo->parent );
-                $bar = get_term_by( 'slug', 'bar', 'category' );
-                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
-                $this->assertEquals( $bar->term_id, $foo_bar->parent );
-
-                $post_count = wp_count_posts( 'post' );
-                $this->assertEquals( 5, $post_count->publish );
-                $this->assertEquals( 1, $post_count->private );
-                $page_count = wp_count_posts( 'page' );
-                $this->assertEquals( 4, $page_count->publish );
-                $this->assertEquals( 1, $page_count->draft );
-                $comment_count = wp_count_comments();
-                $this->assertEquals( 1, $comment_count->total_comments );
-        }
-
-        // function test_menu_import
-}
-
-class TestImportWP_PostMeta extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-                        
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-                        
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-        
-        function test_serialized_postmeta_no_cdata() {
-                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' => false ) );        
-                $expected['special_post_title'] = 'A special title';
-                $expected['is_calendar'] = '';        
-                $this->assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
-        }
-        
-        function test_utw_postmeta() {
-                $this->_import_wp( DIR_TESTDATA . '/export/test-utw-post-meta-import.xml', array( 'johncoswell' => false ) );
-
-                $classy = new StdClass();
-                $classy->tag = "album";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "apple";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "art";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "artwork";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "dead-tracks";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "ipod";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "itunes";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "javascript";
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy->tag = "lyrics";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "script";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "tracks";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "windows-scripting-host";
-                $expected[] = $classy;        
-                $classy = new StdClass();
-                $classy->tag = "wscript";
-                $expected[] = $classy;        
-                
-                $this->assertEquals( $expected, get_post_meta( 150, 'test', true ) );
-        }
-}
-
-class TestImportWP_PostMetaCDATA extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-
-        // #9633
-        function test_serialized_postmeta_with_cdata() {
-                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => false ) );
-
-                //HTML in the CDATA should work with old WordPress version
-                $this->assertEquals( '<pre>some html</pre>', get_post_meta( 10, 'contains-html', true ) );                
-                //Serialised will only work with 3.0 onwards.
-                $expected["special_post_title"] = "A special title";
-                $expected["is_calendar"] = "";
-                $this->assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );                
-        }
-
-        // #11574
-        function test_serialized_postmeta_with_evil_stuff_in_cdata() {
-                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => false ) );
-                // evil content in the CDATA
-                $this->assertEquals( '<wp:meta_value>evil</wp:meta_value>', get_post_meta( 10, 'evil', true ) );
-        }
-}
-
-?>
</del><ins>+<?php
+
+#include_once(DIR_TESTROOT.'/wp-testlib/wp-profiler.php');
+
+// need to include the importer as an external, so path may need to change...
+
+// _nuke_main_tables style function on tearDown? (Should this be part of _WPEmptyBlog tearDown?)
+
+class WXRParserTest extends WPTestCase {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+                        
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );                
+
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+        }
+
+        function tearDown() {
+                parent::tearDown();
+        }
+        
+        function test_malformed_wxr() {
+                $file = DIR_TESTDATA . '/export/malformed.xml';
+        
+                // regex based parser cannot detect malformed XML
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
+                        $parser = new $p;
+                        $result = $parser->parse($file);
+                        $this->assertTrue( is_wp_error( $result ) );
+                        $this->assertEquals( 'There was an error when reading this WXR file', $result->get_error_message() );        
+                }        
+        }        
+
+        function test_invalid_wxr() {
+                $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml';
+                $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml';
+        
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        foreach ( array( $f1, $f2 ) as $file ) {
+                                $parser = new $p;
+                                $result = $parser->parse( $file );                                
+                                $this->assertTrue( is_wp_error( $result ) );
+                                $this->assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );        
+                        }
+                }                        
+        }
+        
+        function test_wxr_version_1_1() {
+                $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml';
+                        
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        $message = $p . ' failed';
+                        $parser = new $p;
+                        $result = $parser->parse( $file );        
+                        
+                        $this->assertTrue( is_array( $result ), $message );                        
+                        $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
+                        $this->assertEquals( array(
+                                'author_id' => 2,
+                                'author_login' => 'john',
+                                'author_email' => 'johndoe@example.org',
+                                'author_display_name' => 'John Doe',
+                                'author_first_name' => 'John',
+                                'author_last_name' => 'Doe'
+                        ), $result['authors']['john'], $message );
+                        $this->assertEquals( array(
+                                'term_id' => 3,
+                                'category_nicename' => 'alpha',
+                                'category_parent' => '',
+                                'cat_name' => 'alpha',
+                                'category_description' => 'The alpha category'                        
+                        ), $result['categories'][0], $message );
+                        $this->assertEquals( array(
+                                'term_id' => 22,
+                                'tag_slug' => 'clippable',
+                                'tag_name' => 'Clippable',
+                                'tag_description' => 'The Clippable post_tag'                
+                        ), $result['tags'][0], $message );
+                        $this->assertEquals( array(
+                                'term_id' => 40,
+                                'term_taxonomy' => 'post_tax',
+                                'slug' => 'bieup',
+                                'term_parent' => '',                                
+                                'term_name' => 'bieup',
+                                'term_description' => 'The bieup post_tax'                
+                        ), $result['terms'][0], $message );                                        
+
+                        $this->assertEquals( 2, count($result['posts']), $message );
+                        $this->assertEquals( 19, count($result['posts'][0]), $message );
+                        $this->assertEquals( 18, count($result['posts'][1]), $message );
+                        $this->assertEquals( array(
+                                array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
+                                array( 'name' => 'Clippable', 'slug' => 'clippable', 'domain' => 'post_tag' ),
+                                array( 'name' => 'bieup', 'slug' => 'bieup', 'domain' => 'post_tax' )
+                        ), $result['posts'][0]['terms'], $message );
+                        $this->assertEquals( array(
+                                array( 'key' => '_wp_page_template', 'value' => 'default' )
+                        ), $result['posts'][1]['postmeta'], $message );        
+                }
+        }
+        
+        function test_wxr_version_1_0() {
+                $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml';
+                
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        $message = $p . ' failed';
+                        $parser = new $p;
+                        $result = $parser->parse( $file );
+                        
+                        $this->assertTrue( is_array( $result ), $message );                        
+                        $this->assertEquals( 'http://localhost/', $result['base_url'], $message );
+                        $this->assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
+                        $this->assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
+                        $this->assertEquals( $result['categories'][0]['category_parent'], '', $message );
+                        $this->assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
+                        $this->assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
+                        $this->assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );        
+
+                        $this->assertEquals( 6, count($result['posts']), $message );
+                        $this->assertEquals( 19, count($result['posts'][0]), $message );
+                        $this->assertEquals( 18, count($result['posts'][1]), $message );
+
+                        $this->assertEquals( array(
+                                array( 'name' => 'Uncategorized', 'slug' => 'uncategorized', 'domain' => 'category' )
+                        ), $result['posts'][0]['terms'], $message );
+                        $this->assertEquals( array(
+                                array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
+                                array( 'name' => 'news', 'slug' => 'news', 'domain' => 'tag' ),
+                                array( 'name' => 'roar', 'slug' => 'roar', 'domain' => 'tag' )
+                        ), $result['posts'][2]['terms'], $message );
+                        $this->assertEquals( array(
+                                array( 'name' => 'chicken', 'slug' => 'chicken', 'domain' => 'tag' ),
+                                array( 'name' => 'child', 'slug' => 'child', 'domain' => 'category' ),
+                                array( 'name' => 'face', 'slug' => 'face', 'domain' => 'tag' )
+                        ), $result['posts'][3]['terms'], $message );
+
+                        $this->assertEquals( array(
+                                array( 'key' => '_wp_page_template', 'value' => 'default' )
+                        ), $result['posts'][1]['postmeta'], $message );
+                }
+        }
+        
+        // tags in CDATA #11574
+}
+
+class WPImportTest extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+                        
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+                        
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+
+                global $wpdb;
+                // crude but effective: make sure there's no residual data in the main tables
+                foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
+                        $wpdb->query("DELETE FROM {$wpdb->$table}");
+        }
+
+        function tearDown() {
+                parent::tearDown();
+
+                $this->_delete_all_posts();
+
+                if ( $user = get_user_by( 'login', 'admin' ) )
+                        wp_delete_user( $user->ID );
+                if ( $user = get_user_by( 'login', 'editor' ) )
+                        wp_delete_user( $user->ID );
+                if ( $user = get_user_by( 'login', 'author' ) )
+                        wp_delete_user( $user->ID );
+        }
+        
+        function test_small_import() {
+                global $wpdb;
+
+                $authors = array( 'admin' => false, 'editor' => false, 'author' => false );        
+                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+                // ensure that authors were imported correctly
+                $user_count = count_users();
+                $this->assertEquals( 3, $user_count['total_users'] );
+                $admin = get_user_by( 'login', 'admin' );
+                $this->assertEquals( 'admin', $admin->user_login );
+                $this->assertEquals( 'local@host.null', $admin->user_email );
+                $editor = get_user_by( 'login', 'editor' );
+                $this->assertEquals( 'editor', $editor->user_login );
+                $this->assertEquals( 'editor@example.org', $editor->user_email );
+                $this->assertEquals( 'FirstName', $editor->user_firstname );
+                $this->assertEquals( 'LastName', $editor->user_lastname );
+                $author = get_user_by( 'login', 'author' );
+                $this->assertEquals( 'author', $author->user_login );
+                $this->assertEquals( 'author@example.org', $author->user_email );
+
+                // check that terms were imported correctly
+                $this->assertEquals( 30, wp_count_terms( 'category' ) );
+                $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
+                $foo = get_term_by( 'slug', 'foo', 'category' );
+                $this->assertEquals( 0, $foo->parent );
+                $bar = get_term_by( 'slug', 'bar', 'category' );
+                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+                $this->assertEquals( $bar->term_id, $foo_bar->parent );
+
+                // check that posts/pages were imported correctly
+                $post_count = wp_count_posts( 'post' );
+                $this->assertEquals( 5, $post_count->publish );
+                $this->assertEquals( 1, $post_count->private );
+                $page_count = wp_count_posts( 'page' );
+                $this->assertEquals( 4, $page_count->publish );
+                $this->assertEquals( 1, $page_count->draft );
+                $comment_count = wp_count_comments();
+                $this->assertEquals( 1, $comment_count->total_comments );
+
+                $posts = get_posts( array( 'numberposts' => 20, 'post_type' => 'any', 'post_status' => 'any', 'orderby' => 'ID' ) );
+                $this->assertEquals( 11, count($posts) );
+
+                $post = $posts[0];
+                $this->assertEquals( 'Many Categories', $post->post_title );
+                $this->assertEquals( 'many-categories', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID );
+                $this->assertEquals( 27, count($cats) );
+
+                $post = $posts[1];
+                $this->assertEquals( 'Non-standard post format', $post->post_title );
+                $this->assertEquals( 'non-standard-post-format', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID );
+                $this->assertEquals( 1, count($cats) );
+                $this->assertTrue( has_post_format( 'aside', $post->ID ) );
+
+                $post = $posts[2];
+                $this->assertEquals( 'Top-level Foo', $post->post_title );
+                $this->assertEquals( 'top-level-foo', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
+                $this->assertEquals( 1, count($cats) );
+                $this->assertEquals( 'foo', $cats[0]->slug );
+
+                $post = $posts[3];
+                $this->assertEquals( 'Foo-child', $post->post_title );
+                $this->assertEquals( 'foo-child', $post->post_name );
+                $this->assertEquals( $editor->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
+                $this->assertEquals( 1, count($cats) );
+                $this->assertEquals( 'foo-bar', $cats[0]->slug );
+
+                $post = $posts[4];
+                $this->assertEquals( 'Private Post', $post->post_title );
+                $this->assertEquals( 'private-post', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'private', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID );
+                $this->assertEquals( 1, count($cats) );
+                $tags = wp_get_post_tags( $post->ID );
+                $this->assertEquals( 3, count($tags) );
+                $this->assertEquals( 'tag1', $tags[0]->slug );
+                $this->assertEquals( 'tag2', $tags[1]->slug );
+                $this->assertEquals( 'tag3', $tags[2]->slug );
+
+                $post = $posts[5];
+                $this->assertEquals( '1-col page', $post->post_title );
+                $this->assertEquals( '1-col-page', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'page', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $this->assertEquals( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+                $post = $posts[6];
+                $this->assertEquals( 'Draft Page', $post->post_title );
+                $this->assertEquals( '', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'page', $post->post_type );
+                $this->assertEquals( 'draft', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+                $post = $posts[7];
+                $this->assertEquals( 'Parent Page', $post->post_title );
+                $this->assertEquals( 'parent-page', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'page', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+                $post = $posts[8];
+                $this->assertEquals( 'Child Page', $post->post_title );
+                $this->assertEquals( 'child-page', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'page', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( $posts[7]->ID, $post->post_parent );
+                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+                $post = $posts[9];
+                $this->assertEquals( 'Sample Page', $post->post_title );
+                $this->assertEquals( 'sample-page', $post->post_name );
+                $this->assertEquals( $admin->ID, $post->post_author );
+                $this->assertEquals( 'page', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+                $post = $posts[10];
+                $this->assertEquals( 'Hello world!', $post->post_title );
+                $this->assertEquals( 'hello-world', $post->post_name );
+                $this->assertEquals( $author->ID, $post->post_author );
+                $this->assertEquals( 'post', $post->post_type );
+                $this->assertEquals( 'publish', $post->post_status );
+                $this->assertEquals( 0, $post->post_parent );
+                $cats = wp_get_post_categories( $post->ID );
+                $this->assertEquals( 1, count($cats) );
+        }
+        
+        function test_double_import() {
+                $authors = array( 'admin' => false, 'editor' => false, 'author' => false );
+                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+                $this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+                $user_count = count_users();
+                $this->assertEquals( 3, $user_count['total_users'] );
+                $admin = get_user_by( 'login', 'admin' );
+                $this->assertEquals( 'admin', $admin->user_login );
+                $this->assertEquals( 'local@host.null', $admin->user_email );
+                $editor = get_user_by( 'login', 'editor' );
+                $this->assertEquals( 'editor', $editor->user_login );
+                $this->assertEquals( 'editor@example.org', $editor->user_email );
+                $this->assertEquals( 'FirstName', $editor->user_firstname );
+                $this->assertEquals( 'LastName', $editor->user_lastname );
+                $author = get_user_by( 'login', 'author' );
+                $this->assertEquals( 'author', $author->user_login );
+                $this->assertEquals( 'author@example.org', $author->user_email );
+
+                $this->assertEquals( 30, wp_count_terms( 'category' ) );
+                $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
+                $foo = get_term_by( 'slug', 'foo', 'category' );
+                $this->assertEquals( 0, $foo->parent );
+                $bar = get_term_by( 'slug', 'bar', 'category' );
+                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+                $this->assertEquals( $bar->term_id, $foo_bar->parent );
+
+                $post_count = wp_count_posts( 'post' );
+                $this->assertEquals( 5, $post_count->publish );
+                $this->assertEquals( 1, $post_count->private );
+                $page_count = wp_count_posts( 'page' );
+                $this->assertEquals( 4, $page_count->publish );
+                $this->assertEquals( 1, $page_count->draft );
+                $comment_count = wp_count_comments();
+                $this->assertEquals( 1, $comment_count->total_comments );
+        }
+
+        // function test_menu_import
+}
+
+class TestImportWP_PostMeta extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+                
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+                        
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+                        
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+        }
+
+        function tearDown() {
+                parent::tearDown();
+        }
+        
+        function test_serialized_postmeta_no_cdata() {
+                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' => false ) );        
+                $expected['special_post_title'] = 'A special title';
+                $expected['is_calendar'] = '';        
+                $this->assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
+        }
+        
+        function test_utw_postmeta() {
+                $this->_import_wp( DIR_TESTDATA . '/export/test-utw-post-meta-import.xml', array( 'johncoswell' => false ) );
+
+                $classy = new StdClass();
+                $classy->tag = "album";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "apple";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "art";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "artwork";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "dead-tracks";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "ipod";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "itunes";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "javascript";
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy->tag = "lyrics";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "script";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "tracks";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "windows-scripting-host";
+                $expected[] = $classy;        
+                $classy = new StdClass();
+                $classy->tag = "wscript";
+                $expected[] = $classy;        
+                
+                $this->assertEquals( $expected, get_post_meta( 150, 'test', true ) );
+        }
+}
+
+class TestImportWP_PostMetaCDATA extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+        }
+
+        function tearDown() {
+                parent::tearDown();
+        }
+
+        // #9633
+        function test_serialized_postmeta_with_cdata() {
+                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => false ) );
+
+                //HTML in the CDATA should work with old WordPress version
+                $this->assertEquals( '<pre>some html</pre>', get_post_meta( 10, 'contains-html', true ) );                
+                //Serialised will only work with 3.0 onwards.
+                $expected["special_post_title"] = "A special title";
+                $expected["is_calendar"] = "";
+                $this->assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );                
+        }
+
+        // #11574
+        function test_serialized_postmeta_with_evil_stuff_in_cdata() {
+                $this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => false ) );
+                // evil content in the CDATA
+                $this->assertEquals( '<wp:meta_value>evil</wp:meta_value>', get_post_meta( 10, 'evil', true ) );
+        }
+}
+
+?>
</ins><span class="cx">Property changes on: wp-testcase/test_import_wp.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_cachephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_cache.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_classwpdependenciesphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_class-wp-dependencies.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_compatphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_compat.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_feed_rss2php"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_feed_rss2.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_filephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_file.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_formattingphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_formatting.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_functionsphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_functions.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_pluggablephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_pluggable.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_postphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_post.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_taxonomyphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_taxonomy.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_themephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_theme.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_wpscriptsphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_wp-scripts.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_includes_wpstylesphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_includes_wp-styles.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_link_functionsphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_link_functions.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_metaphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_meta.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_post_filteringphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_post_filtering.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_post_outputphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_post_output.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_post_output.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_post_output.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,329 +1,329 @@
</span><del>-<?php
-
-// test the output of post template tags etc
-
-class _WPTestSinglePost extends _WPEmptyBlog {
-
-        var $post_title = NULL;
-        var $post_content = NULL;
-
-        var $the_title = NULL;
-        var $the_content = NULL;
-
-        function _do_post() {
-                $post = array(
-                        'post_author' => $this->author->ID,
-                        'post_status' => 'publish',
-                        'post_content' => $this->post_content,
-                        'post_title' => $this->post_title,
-                );
-
-                // insert a post
-                $this->post_id = $this->post_ids[] = wp_insert_post($post);
-
-                // pretend we're on the single permlink page for that post
-                $out = wp_get_single_post($this->post_id);
-                $this->http(get_permalink($this->post_id));
-
-                $this->assertTrue(is_single());
-                $this->assertTrue(have_posts());
-                $this->assertNull(the_post());
-        }
-
-
-}
-
-class WPTestPostMoreVB extends _WPTestSinglePost {
-
-        function setUp() {
-
-                $this->post_content =<<<EOF
-<i>This is the excerpt.</i>
-<!--more-->
-This is the <b>body</b>.
-EOF;
-
-                parent::setUp();
-        }
-
-        function test_the_content() {
-                $this->_do_post();
-                $the_content =<<<EOF
-<p><i>This is the excerpt.</i><br />
-<span id="more-{$this->post_id}"></span><br />
-This is the <b>body</b>.</p>
-EOF;
-
-                $this->assertEquals(strip_ws($the_content), strip_ws(get_echo('the_content')));
-        }
-
-}
-
-class WPTestShortcodeOutput1 extends _WPTestSinglePost {
-        function setUp() {
-
-                $this->post_content =<<<EOF
-[dumptag foo="bar" baz="123"]
-
-[dumptag foo=123 baz=bar]
-
-[dumptag http://example.com]
-
-EOF;
-
-                parent::setUp();
-        }
-
-        function test_the_content() {
-                $this->_do_post();
-                $expected =<<<EOF
-foo = bar
-baz = 123
-foo = 123
-baz = bar
-0 = http://example.com
-
-EOF;
-
-                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
-        }
-}
-
-class WPTestShortcodeOutputParagraph extends _WPTestSinglePost {
-        function setUp() {
-
-                $this->post_content =<<<EOF
-Graf by itself:
-
-[paragraph]my graf[/paragraph]
-
- [paragraph foo="bar"]another graf with whitespace[/paragraph]
-
-An [paragraph]inline graf[/paragraph], this doesn't make much sense.
-
-A graf with a single EOL first:
-[paragraph]blah[/paragraph]
-
-EOF;
-
-                parent::setUp();
-        }
-
-        function test_the_content() {
-                $this->_do_post();
-                $expected =<<<EOF
-<p>Graf by itself:</p>
-<p class='graf'>my graf</p>
-
- <p class='graf'>another graf with whitespace</p>
-
-<p>An <p class='graf'>inline graf</p>
-, this doesn&#8217;t make much sense.</p>
-<p>A graf with a single EOL first:<br />
-<p class='graf'>blah</p>
-</p>
-
-EOF;
-
-                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
-        }
-}
-
-class WPTestGalleryPost extends _WPDataset1 {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
-                $wp_rewrite->flush_rules();
-        }
-        
-        function test_the_content() {
-                // permalink page
-                $this->http('/2008/04/01/simple-gallery-test/');
-                the_post();
-                // filtered output
-                $out = get_echo('the_content');
-                
-                $expected = <<<EOF
-<p>There are ten images attached to this post. Â Here&#8217;s a gallery:</p>
-
-                <style type='text/css'>
-                        .gallery {
-                                margin: auto;
-                        }
-                        .gallery-item {
-                                float: left;
-                                margin-top: 10px;
-                                text-align: center;
-                                width: 33%;                        }
-                        .gallery img {
-                                border: 2px solid #cfcfcf;
-                        }
-                        .gallery-caption {
-                                margin-left: 0;
-                        }
-                </style>
-                <!-- see gallery_shortcode() in wp-includes/media.php -->
-                <div class='gallery'><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20040724_152504_53/' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/canola/' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050315_145007_13/' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050604_133440_34/' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050831_165238_33/' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050901_105100_21/' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050813_115856_5/' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050720_123726_27/' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050727_091048_22/' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050726_083116_18/' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-thumbnail" alt="" /></a>
-                        </dt></dl>
-                        <br style='clear: both;' />
-                </div>
-
-<p>It&#8217;s the simplest form of the gallery tag. Â All images are from the public domain site burningwell.org.</p>
-<p>The images have various combinations of titles, captions and descriptions.</p>
-EOF;
-                $this->assertEquals(strip_ws($expected), strip_ws($out));
-        }
-
-        function test_gallery_attributes() {
-                // make sure the gallery shortcode attributes are parsed correctly
-                
-                $id = 575;
-                $post = get_post($id);
-                $post->post_content = '[gallery columns="1" size="medium"]';
-                wp_update_post($post);
-                
-                // permalink page
-                $this->http('/2008/04/01/simple-gallery-test/');
-                the_post();
-                // filtered output
-                $out = get_echo('the_content');
-
-                $expected = <<<EOF
-                <style type='text/css'>
-                        .gallery {
-                                margin: auto;
-                        }
-                        .gallery-item {
-                                float: left;
-                                margin-top: 10px;
-                                text-align: center;
-                                width: 100%;                        }
-                        .gallery img {
-                                border: 2px solid #cfcfcf;
-                        }
-                        .gallery-caption {
-                                margin-left: 0;
-                        }
-                </style>
-                <!-- see gallery_shortcode() in wp-includes/media.php -->
-                <div class='gallery'><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=565' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=566' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=567' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=568' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=569' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=570' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=571' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=572' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=573' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
-                        <dt class='gallery-icon'>
-                                <a href='http://example.com/?attachment_id=574' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-medium" alt="" /></a>
-                        </dt></dl><br style="clear: both" />
-                        <br style='clear: both;' />
-                </div>
-
-EOF;
-                $this->assertEquals(strip_ws($expected), strip_ws($out));
-        }
-
-}
-
-
-
-class WPTestAttributeFiltering extends _WPTestSinglePost {
-        function setUp() {
-
-                // http://bpr3.org/?p=87
-                // the title attribute should make it through unfiltered
-                $this->post_content =<<<EOF
-<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.aulast=Mariat&rft.aufirst=Denis&rft. au=Denis+Mariat&rft.au=Sead+Taourit&rft.au=G%C3%A9rard+Gu%C3%A9rin& rft.title=Genetics+Selection+Evolution&rft.atitle=&rft.date=2003&rft. volume=35&rft.issue=1&rft.spage=119&rft.epage=133&rft.genre=article& rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., Guérin, G. (2003). . <span style="font-style: italic;">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href= "http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a>
-
-EOF;
-
-                parent::setUp();
-        }
-
-        function test_the_content() {
-                $this->_do_post();
-                $expected =<<<EOF
-<p><span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.aulast=Mariat&rft.aufirst=Denis&rft. au=Denis+Mariat&rft.au=Sead+Taourit&rft.au=G%C3%A9rard+Gu%C3%A9rin& rft.title=Genetics+Selection+Evolution&rft.atitle=&rft.date=2003&rft. volume=35&rft.issue=1&rft.spage=119&rft.epage=133&rft.genre=article& rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., Guérin, G. (2003). . <span style="font-style: italic;">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href= "http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a></p>
-
-EOF;
-
-                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
-        }
-}
-
-class WPTestAttributeColon extends _WPTestSinglePost {
-        function setUp() {
-
-                // http://bpr3.org/?p=87
-                // the title attribute should make it through unfiltered
-                $this->post_content =<<<EOF
-<span title="My friends: Alice, Bob and Carol">foo</span>
-
-EOF;
-
-                parent::setUp();
-        }
-
-        function test_the_content() {
-                $this->_do_post();
-                $expected =<<<EOF
-<p><span title="My friends: Alice, Bob and Carol">foo</span></p>
-
-EOF;
-
-                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
-        }
-}
-
</del><ins>+<?php
+
+// test the output of post template tags etc
+
+class _WPTestSinglePost extends _WPEmptyBlog {
+
+        var $post_title = NULL;
+        var $post_content = NULL;
+
+        var $the_title = NULL;
+        var $the_content = NULL;
+
+        function _do_post() {
+                $post = array(
+                        'post_author' => $this->author->ID,
+                        'post_status' => 'publish',
+                        'post_content' => $this->post_content,
+                        'post_title' => $this->post_title,
+                );
+
+                // insert a post
+                $this->post_id = $this->post_ids[] = wp_insert_post($post);
+
+                // pretend we're on the single permlink page for that post
+                $out = wp_get_single_post($this->post_id);
+                $this->http(get_permalink($this->post_id));
+
+                $this->assertTrue(is_single());
+                $this->assertTrue(have_posts());
+                $this->assertNull(the_post());
+        }
+
+
+}
+
+class WPTestPostMoreVB extends _WPTestSinglePost {
+
+        function setUp() {
+
+                $this->post_content =<<<EOF
+<i>This is the excerpt.</i>
+<!--more-->
+This is the <b>body</b>.
+EOF;
+
+                parent::setUp();
+        }
+
+        function test_the_content() {
+                $this->_do_post();
+                $the_content =<<<EOF
+<p><i>This is the excerpt.</i><br />
+<span id="more-{$this->post_id}"></span><br />
+This is the <b>body</b>.</p>
+EOF;
+
+                $this->assertEquals(strip_ws($the_content), strip_ws(get_echo('the_content')));
+        }
+
+}
+
+class WPTestShortcodeOutput1 extends _WPTestSinglePost {
+        function setUp() {
+
+                $this->post_content =<<<EOF
+[dumptag foo="bar" baz="123"]
+
+[dumptag foo=123 baz=bar]
+
+[dumptag http://example.com]
+
+EOF;
+
+                parent::setUp();
+        }
+
+        function test_the_content() {
+                $this->_do_post();
+                $expected =<<<EOF
+foo = bar
+baz = 123
+foo = 123
+baz = bar
+0 = http://example.com
+
+EOF;
+
+                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
+        }
+}
+
+class WPTestShortcodeOutputParagraph extends _WPTestSinglePost {
+        function setUp() {
+
+                $this->post_content =<<<EOF
+Graf by itself:
+
+[paragraph]my graf[/paragraph]
+
+ [paragraph foo="bar"]another graf with whitespace[/paragraph]
+
+An [paragraph]inline graf[/paragraph], this doesn't make much sense.
+
+A graf with a single EOL first:
+[paragraph]blah[/paragraph]
+
+EOF;
+
+                parent::setUp();
+        }
+
+        function test_the_content() {
+                $this->_do_post();
+                $expected =<<<EOF
+<p>Graf by itself:</p>
+<p class='graf'>my graf</p>
+
+ <p class='graf'>another graf with whitespace</p>
+
+<p>An <p class='graf'>inline graf</p>
+, this doesn&#8217;t make much sense.</p>
+<p>A graf with a single EOL first:<br />
+<p class='graf'>blah</p>
+</p>
+
+EOF;
+
+                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
+        }
+}
+
+class WPTestGalleryPost extends _WPDataset1 {
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+                $wp_rewrite->flush_rules();
+        }
+        
+        function test_the_content() {
+                // permalink page
+                $this->http('/2008/04/01/simple-gallery-test/');
+                the_post();
+                // filtered output
+                $out = get_echo('the_content');
+                
+                $expected = <<<EOF
+<p>There are ten images attached to this post. Â Here&#8217;s a gallery:</p>
+
+                <style type='text/css'>
+                        .gallery {
+                                margin: auto;
+                        }
+                        .gallery-item {
+                                float: left;
+                                margin-top: 10px;
+                                text-align: center;
+                                width: 33%;                        }
+                        .gallery img {
+                                border: 2px solid #cfcfcf;
+                        }
+                        .gallery-caption {
+                                margin-left: 0;
+                        }
+                </style>
+                <!-- see gallery_shortcode() in wp-includes/media.php -->
+                <div class='gallery'><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20040724_152504_53/' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/canola/' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050315_145007_13/' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050604_133440_34/' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050831_165238_33/' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050901_105100_21/' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050813_115856_5/' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050720_123726_27/' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050727_091048_22/' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050726_083116_18/' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-thumbnail" alt="" /></a>
+                        </dt></dl>
+                        <br style='clear: both;' />
+                </div>
+
+<p>It&#8217;s the simplest form of the gallery tag. Â All images are from the public domain site burningwell.org.</p>
+<p>The images have various combinations of titles, captions and descriptions.</p>
+EOF;
+                $this->assertEquals(strip_ws($expected), strip_ws($out));
+        }
+
+        function test_gallery_attributes() {
+                // make sure the gallery shortcode attributes are parsed correctly
+                
+                $id = 575;
+                $post = get_post($id);
+                $post->post_content = '[gallery columns="1" size="medium"]';
+                wp_update_post($post);
+                
+                // permalink page
+                $this->http('/2008/04/01/simple-gallery-test/');
+                the_post();
+                // filtered output
+                $out = get_echo('the_content');
+
+                $expected = <<<EOF
+                <style type='text/css'>
+                        .gallery {
+                                margin: auto;
+                        }
+                        .gallery-item {
+                                float: left;
+                                margin-top: 10px;
+                                text-align: center;
+                                width: 100%;                        }
+                        .gallery img {
+                                border: 2px solid #cfcfcf;
+                        }
+                        .gallery-caption {
+                                margin-left: 0;
+                        }
+                </style>
+                <!-- see gallery_shortcode() in wp-includes/media.php -->
+                <div class='gallery'><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=565' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=566' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=567' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=568' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=569' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=570' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=571' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=572' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=573' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" /><dl class='gallery-item'>
+                        <dt class='gallery-icon'>
+                                <a href='http://example.com/?attachment_id=574' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-medium" alt="" /></a>
+                        </dt></dl><br style="clear: both" />
+                        <br style='clear: both;' />
+                </div>
+
+EOF;
+                $this->assertEquals(strip_ws($expected), strip_ws($out));
+        }
+
+}
+
+
+
+class WPTestAttributeFiltering extends _WPTestSinglePost {
+        function setUp() {
+
+                // http://bpr3.org/?p=87
+                // the title attribute should make it through unfiltered
+                $this->post_content =<<<EOF
+<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.aulast=Mariat&rft.aufirst=Denis&rft. au=Denis+Mariat&rft.au=Sead+Taourit&rft.au=G%C3%A9rard+Gu%C3%A9rin& rft.title=Genetics+Selection+Evolution&rft.atitle=&rft.date=2003&rft. volume=35&rft.issue=1&rft.spage=119&rft.epage=133&rft.genre=article& rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., Guérin, G. (2003). . <span style="font-style: italic;">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href= "http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a>
+
+EOF;
+
+                parent::setUp();
+        }
+
+        function test_the_content() {
+                $this->_do_post();
+                $expected =<<<EOF
+<p><span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.aulast=Mariat&rft.aufirst=Denis&rft. au=Denis+Mariat&rft.au=Sead+Taourit&rft.au=G%C3%A9rard+Gu%C3%A9rin& rft.title=Genetics+Selection+Evolution&rft.atitle=&rft.date=2003&rft. volume=35&rft.issue=1&rft.spage=119&rft.epage=133&rft.genre=article& rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., Guérin, G. (2003). . <span style="font-style: italic;">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href= "http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a></p>
+
+EOF;
+
+                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
+        }
+}
+
+class WPTestAttributeColon extends _WPTestSinglePost {
+        function setUp() {
+
+                // http://bpr3.org/?p=87
+                // the title attribute should make it through unfiltered
+                $this->post_content =<<<EOF
+<span title="My friends: Alice, Bob and Carol">foo</span>
+
+EOF;
+
+                parent::setUp();
+        }
+
+        function test_the_content() {
+                $this->_do_post();
+                $expected =<<<EOF
+<p><span title="My friends: Alice, Bob and Carol">foo</span></p>
+
+EOF;
+
+                $this->assertEquals(strip_ws($expected), strip_ws(get_echo('the_content')));
+        }
+}
+
</ins><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: wp-testcase/test_post_output.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_queryphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_query.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_query.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_query.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,567 +1,567 @@
</span><del>-<?php
-
-// test the is_*() functions in query.php across the URL structure
-
-// this exercises both query.php and rewrite.php: urls are fed through the rewrite code,
-// then we test the effects of each url on the wp_query object.
-
-class TestWPQueryVars extends _WPDataset1 {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
-                create_initial_taxonomies();
-                $wp_rewrite->flush_rules();
-        }
-
-        function tearDown() {
-                global $wp_rewrite;
-                $wp_rewrite->set_permalink_structure('');
-                parent::tearDown();
-        }
-
-        function _get_post_id_by_name($name) {
-                global $wpdb;
-                $name = $wpdb->escape($name);
-                $page_id = $wpdb->get_var("SELECT ID from {$wpdb->posts} WHERE post_name = '{$name}' LIMIT 1");
-                assert(is_numeric($page_id));
-                return $page_id;
-        }
-
-        function _all_post_ids($type='post') {
-                global $wpdb;
-                $type = $wpdb->escape($type);
-                return $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type='{$type}' and post_status='publish'");
-        }
-
-        /**
-         * Check each of the WP_Query is_* functions/properties against expected boolean value.
-         *
-         * Any properties that are listed by name as parameters will be expected to be true; any others are
-         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
-         * and is_feed() must be true and everything else must be false to pass.
-         *
-         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
-         */
-        function assertQueryTrue(/* ... */) {
-                global $wp_query;
-                $all = array(
-                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
-                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
-                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
-                        'is_posts_page', 'is_post_type_archive',
-                );
-                $true = func_get_args();
-
-                $passed = true;
-                $not_false = $not_true = array(); // properties that were not set to expected values
-                
-                foreach ( $all as $query_thing ) {
-                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing;
-
-                        if ( in_array( $query_thing, $true ) ) {
-                                if ( ! $result ) {
-                                        array_push( $not_true, $query_thing );
-                                        $passed = false;
-                                }
-                        } else if ( $result ) {
-                                array_push( $not_false, $query_thing );
-                                $passed = false;
-                        }
-                }
-
-                $message = '';
-                if ( count($not_true) )
-                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
-                if ( count($not_false) )
-                        $message .= implode( $not_false, ', ' ) . ' should be false.';
-                $this->assertTrue( $passed, $message );
-        }
-
-        function test_home() {
-                $this->http('/');
-                $this->assertQueryTrue('is_home');
-        }
-
-        function test_404() {
-                $this->http('/'.rand_str());
-                $this->assertQueryTrue('is_404');
-        }
-
-        function test_permalink() {
-                $this->http( get_permalink($this->_get_post_id_by_name('hello-world')) );
-                $this->assertQueryTrue('is_single', 'is_singular');
-        }
-
-        function test_post_comments_feed() {
-                $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
-                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-        function test_page() {
-                $page_id = $this->_get_post_id_by_name('about');
-                $this->http(get_permalink($page_id));
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_parent_page() {
-                $page_id = $this->_get_post_id_by_name('parent-page');
-                $this->http(get_permalink($page_id));
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_1() {
-                $page_id = $this->_get_post_id_by_name('child-page-1');
-                $this->http(get_permalink($page_id));
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_2() {
-                $page_id = $this->_get_post_id_by_name('child-page-2');
-                $this->http(get_permalink($page_id));
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
-        function test_page_trackback() {
-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this->_get_post_id_by_name($name);
-                        $url = get_permalink($page_id);
-                        $this->http("{$url}trackback/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page','is_singular','is_trackback');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
-        function test_page_feed() {
-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this->_get_post_id_by_name($name);
-                        $url = get_permalink($page_id);
-                        $this->http("{$url}feed/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-
-        }
-
-        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
-        function test_page_feed_atom() {
-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this->_get_post_id_by_name($name);
-                        $url = get_permalink($page_id);
-                        $this->http("{$url}feed/atom/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
-        function test_page_page_2() {
-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this->_get_post_id_by_name($name);
-                        $url = get_permalink($page_id);
-                        $this->http("{$url}page/2/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        // FIXME: what is this for?
-        // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
-        function test_page_page_2_short() {
-                //return $this->markTestSkipped();
-                // identical to /about/page/2/ ?
-                $this->http('/about/2/');
-
-                $this->assertQueryTrue('is_page', 'is_singular');
-        }
-
-        // FIXME: no tests for these yet
-        // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-
-        // 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
-        // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
-        function test_main_feed_2() {
-                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-
-                // long version
-                foreach ($feeds as $feed) {
-                        $this->http("/feed/{$feed}/");
-                        $this->assertQueryTrue('is_feed');
-                }
-
-                // short version
-                foreach ($feeds as $feed) {
-                        $this->http("/{$feed}/");
-                        $this->assertQueryTrue('is_feed');
-                }
-
-        }
-
-        function test_main_feed() {
-                $types = array('rss2', 'rss', 'atom');
-                foreach ($types as $type) {
-                        $this->http(get_feed_link($type));
-                        $this->assertQueryTrue('is_feed');
-                }
-        }
-
-        // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
-        function test_paged() {
-                for ($i=2; $i<4; $i++) {
-                        $this->http("/page/{$i}/");
-                        $this->assertQueryTrue('is_home', 'is_paged');
-                }
-        }
-
-        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
-        // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
-        function test_main_comments_feed() {
-                // check the url as generated by get_post_comments_feed_link()
-                $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
-                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/comments/feed/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/comments/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-        }
-
-        // 'comments/page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
-        function test_comments_page() {
-                $this->http('/comments/page/2/');
-                $this->assertQueryTrue('is_home', 'is_paged');
-        }
-
-
-        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
-        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
-        function test_search_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/search/test/feed/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_search');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/search/test/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_search');
-                }
-        }
-
-        // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
-        function test_search_paged() {
-                $this->http('/search/test/page/2/');
-                $this->assertQueryTrue('is_search', 'is_paged');
-        }
-
-        // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
-        function test_search() {
-                $this->http('/search/test/');
-                $this->assertQueryTrue('is_search');
-        }
-
-        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
-        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
-        function test_category_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/category/cat-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/category/cat-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-        }
-
-        // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
-        function test_category_paged() {
-                $this->http('/category/uncategorized/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
-        }
-
-        // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
-        function test_category() {
-                $this->http('/category/cat-a/');
-                $this->assertQueryTrue('is_archive', 'is_category');
-        }
-
-        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
-        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
-        function test_tag_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/tag/tag-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/tag/tag-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-        }
-
-        // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
-        function test_tag_paged() {
-                $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404
-                $this->http('/tag/tag-a/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
-        }
-
-        // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
-        function test_tag() {
-                $this->http('/tag/tag-a/');
-                $this->assertQueryTrue('is_archive', 'is_tag');
-        }
-
-        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
-        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
-        function test_author_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/author/user-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/author/user-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-        }
-
-        // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
-        function test_author_paged() {
-                $this->http('/author/user-a/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
-        }
-
-        // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
-        function test_author() {
-                $this->http('/author/user-a/');
-                $this->assertQueryTrue('is_archive', 'is_author');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
-        function test_ymd_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/09/04/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/09/04/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
-        function test_ymd_paged() {
-                $this->http('/2007/09/04/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
-        function test_ymd() {
-                $this->http('/2007/09/04/');
-                $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
-        }
-        
-        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
-        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
-        function test_ym_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/09/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/09/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
-        function test_ym_paged() {
-                $this->http('/2007/09/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
-        function test_ym() {
-                $this->http('/2007/09/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
-        }
-
-        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
-        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
-        function test_y_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->http("/2007/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
-        function test_y_paged() {
-                $this->http('/2007/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
-        }
-
-        // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
-        function test_y() {
-                $this->http('/2007/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
-        }
-
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
-        function test_post_trackback() {
-                foreach ($this->_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
-                        $this->http("{$permalink}trackback/");
-                        $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
-        function test_post_comment_feed() {
-                foreach ($this->_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
-                        
-                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                        foreach ($types as $type) {
-                                        $this->http("{$permalink}feed/{$type}");
-                                        $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                        }
-
-                        // check the short form
-                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                        foreach ($types as $type) {
-                                        $this->http("{$permalink}{$type}");
-                                        $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                        }
-
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]',
-        function test_post_paged_long() {
-                $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts
-                // the long version
-                $this->http('/2007/09/04/a-post-with-multiple-pages/page/2/');
-                // should is_paged be true also?
-                $this->assertQueryTrue('is_single', 'is_singular');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
-        function test_post_paged_short() {
-                $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1
-                // and the short version
-                $this->http('/2007/09/04/a-post-with-multiple-pages/2/');
-                // should is_paged be true also?
-                $this->assertQueryTrue('is_single', 'is_singular');
-                
-        }
-        
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        function test_post_attachment() {
-                $this->markTestSkipped(); // @todo ID 8 is a page in Data Set 1
-                $permalink = get_attachment_link(8);
-                $this->http($permalink);
-                $this->assertQueryTrue('is_attachment', 'is_singular');
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-}
-
-class TestWPQueryVerbosePageRules extends TestWPQueryVars {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                $wp_rewrite->set_permalink_structure('/%author%/%year%/%postname%/');
-                create_initial_taxonomies();
-                $wp_rewrite->flush_rules();
-        }
-}
-
-?>
</del><ins>+<?php
+
+// test the is_*() functions in query.php across the URL structure
+
+// this exercises both query.php and rewrite.php: urls are fed through the rewrite code,
+// then we test the effects of each url on the wp_query object.
+
+class TestWPQueryVars extends _WPDataset1 {
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+                create_initial_taxonomies();
+                $wp_rewrite->flush_rules();
+        }
+
+        function tearDown() {
+                global $wp_rewrite;
+                $wp_rewrite->set_permalink_structure('');
+                parent::tearDown();
+        }
+
+        function _get_post_id_by_name($name) {
+                global $wpdb;
+                $name = $wpdb->escape($name);
+                $page_id = $wpdb->get_var("SELECT ID from {$wpdb->posts} WHERE post_name = '{$name}' LIMIT 1");
+                assert(is_numeric($page_id));
+                return $page_id;
+        }
+
+        function _all_post_ids($type='post') {
+                global $wpdb;
+                $type = $wpdb->escape($type);
+                return $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type='{$type}' and post_status='publish'");
+        }
+
+        /**
+         * Check each of the WP_Query is_* functions/properties against expected boolean value.
+         *
+         * Any properties that are listed by name as parameters will be expected to be true; any others are
+         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
+         * and is_feed() must be true and everything else must be false to pass.
+         *
+         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
+         */
+        function assertQueryTrue(/* ... */) {
+                global $wp_query;
+                $all = array(
+                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
+                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
+                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
+                        'is_posts_page', 'is_post_type_archive',
+                );
+                $true = func_get_args();
+
+                $passed = true;
+                $not_false = $not_true = array(); // properties that were not set to expected values
+                
+                foreach ( $all as $query_thing ) {
+                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing;
+
+                        if ( in_array( $query_thing, $true ) ) {
+                                if ( ! $result ) {
+                                        array_push( $not_true, $query_thing );
+                                        $passed = false;
+                                }
+                        } else if ( $result ) {
+                                array_push( $not_false, $query_thing );
+                                $passed = false;
+                        }
+                }
+
+                $message = '';
+                if ( count($not_true) )
+                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
+                if ( count($not_false) )
+                        $message .= implode( $not_false, ', ' ) . ' should be false.';
+                $this->assertTrue( $passed, $message );
+        }
+
+        function test_home() {
+                $this->http('/');
+                $this->assertQueryTrue('is_home');
+        }
+
+        function test_404() {
+                $this->http('/'.rand_str());
+                $this->assertQueryTrue('is_404');
+        }
+
+        function test_permalink() {
+                $this->http( get_permalink($this->_get_post_id_by_name('hello-world')) );
+                $this->assertQueryTrue('is_single', 'is_singular');
+        }
+
+        function test_post_comments_feed() {
+                $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
+                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+        function test_page() {
+                $page_id = $this->_get_post_id_by_name('about');
+                $this->http(get_permalink($page_id));
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_parent_page() {
+                $page_id = $this->_get_post_id_by_name('parent-page');
+                $this->http(get_permalink($page_id));
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_1() {
+                $page_id = $this->_get_post_id_by_name('child-page-1');
+                $this->http(get_permalink($page_id));
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_2() {
+                $page_id = $this->_get_post_id_by_name('child-page-2');
+                $this->http(get_permalink($page_id));
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
+        function test_page_trackback() {
+                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
+                foreach ($pages as $name) {
+                        $page_id = $this->_get_post_id_by_name($name);
+                        $url = get_permalink($page_id);
+                        $this->http("{$url}trackback/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page','is_singular','is_trackback');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+        function test_page_feed() {
+                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
+                foreach ($pages as $name) {
+                        $page_id = $this->_get_post_id_by_name($name);
+                        $url = get_permalink($page_id);
+                        $this->http("{$url}feed/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+
+        }
+
+        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+        function test_page_feed_atom() {
+                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
+                foreach ($pages as $name) {
+                        $page_id = $this->_get_post_id_by_name($name);
+                        $url = get_permalink($page_id);
+                        $this->http("{$url}feed/atom/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
+        function test_page_page_2() {
+                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
+                foreach ($pages as $name) {
+                        $page_id = $this->_get_post_id_by_name($name);
+                        $url = get_permalink($page_id);
+                        $this->http("{$url}page/2/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        // FIXME: what is this for?
+        // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
+        function test_page_page_2_short() {
+                //return $this->markTestSkipped();
+                // identical to /about/page/2/ ?
+                $this->http('/about/2/');
+
+                $this->assertQueryTrue('is_page', 'is_singular');
+        }
+
+        // FIXME: no tests for these yet
+        // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+
+        // 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+        // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+        function test_main_feed_2() {
+                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+
+                // long version
+                foreach ($feeds as $feed) {
+                        $this->http("/feed/{$feed}/");
+                        $this->assertQueryTrue('is_feed');
+                }
+
+                // short version
+                foreach ($feeds as $feed) {
+                        $this->http("/{$feed}/");
+                        $this->assertQueryTrue('is_feed');
+                }
+
+        }
+
+        function test_main_feed() {
+                $types = array('rss2', 'rss', 'atom');
+                foreach ($types as $type) {
+                        $this->http(get_feed_link($type));
+                        $this->assertQueryTrue('is_feed');
+                }
+        }
+
+        // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
+        function test_paged() {
+                for ($i=2; $i<4; $i++) {
+                        $this->http("/page/{$i}/");
+                        $this->assertQueryTrue('is_home', 'is_paged');
+                }
+        }
+
+        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+        // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+        function test_main_comments_feed() {
+                // check the url as generated by get_post_comments_feed_link()
+                $this->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
+                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/comments/feed/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/comments/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+        }
+
+        // 'comments/page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
+        function test_comments_page() {
+                $this->http('/comments/page/2/');
+                $this->assertQueryTrue('is_home', 'is_paged');
+        }
+
+
+        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+        function test_search_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/search/test/feed/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_search');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/search/test/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_search');
+                }
+        }
+
+        // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
+        function test_search_paged() {
+                $this->http('/search/test/page/2/');
+                $this->assertQueryTrue('is_search', 'is_paged');
+        }
+
+        // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
+        function test_search() {
+                $this->http('/search/test/');
+                $this->assertQueryTrue('is_search');
+        }
+
+        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+        function test_category_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/category/cat-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/category/cat-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+        }
+
+        // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
+        function test_category_paged() {
+                $this->http('/category/uncategorized/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
+        }
+
+        // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
+        function test_category() {
+                $this->http('/category/cat-a/');
+                $this->assertQueryTrue('is_archive', 'is_category');
+        }
+
+        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+        function test_tag_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/tag/tag-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/tag/tag-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+        }
+
+        // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
+        function test_tag_paged() {
+                $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404
+                $this->http('/tag/tag-a/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
+        }
+
+        // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
+        function test_tag() {
+                $this->http('/tag/tag-a/');
+                $this->assertQueryTrue('is_archive', 'is_tag');
+        }
+
+        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+        function test_author_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/author/user-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/author/user-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+        }
+
+        // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
+        function test_author_paged() {
+                $this->http('/author/user-a/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
+        }
+
+        // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
+        function test_author() {
+                $this->http('/author/user-a/');
+                $this->assertQueryTrue('is_archive', 'is_author');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+        function test_ymd_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/09/04/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/09/04/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
+        function test_ymd_paged() {
+                $this->http('/2007/09/04/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
+        function test_ymd() {
+                $this->http('/2007/09/04/');
+                $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
+        }
+        
+        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+        function test_ym_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/09/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/09/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
+        function test_ym_paged() {
+                $this->http('/2007/09/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
+        function test_ym() {
+                $this->http('/2007/09/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
+        }
+
+        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+        function test_y_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->http("/2007/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
+        function test_y_paged() {
+                $this->http('/2007/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
+        }
+
+        // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
+        function test_y() {
+                $this->http('/2007/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
+        }
+
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
+        function test_post_trackback() {
+                foreach ($this->_all_post_ids() as $id) {
+                        $permalink = get_permalink($id);
+                        $this->http("{$permalink}trackback/");
+                        $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+        function test_post_comment_feed() {
+                foreach ($this->_all_post_ids() as $id) {
+                        $permalink = get_permalink($id);
+                        
+                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                        foreach ($types as $type) {
+                                        $this->http("{$permalink}feed/{$type}");
+                                        $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                        }
+
+                        // check the short form
+                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                        foreach ($types as $type) {
+                                        $this->http("{$permalink}{$type}");
+                                        $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                        }
+
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]',
+        function test_post_paged_long() {
+                $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts
+                // the long version
+                $this->http('/2007/09/04/a-post-with-multiple-pages/page/2/');
+                // should is_paged be true also?
+                $this->assertQueryTrue('is_single', 'is_singular');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
+        function test_post_paged_short() {
+                $this->markTestSkipped(); // @todo post doesn't exist in Data Set 1
+                // and the short version
+                $this->http('/2007/09/04/a-post-with-multiple-pages/2/');
+                // should is_paged be true also?
+                $this->assertQueryTrue('is_single', 'is_singular');
+                
+        }
+        
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        function test_post_attachment() {
+                $this->markTestSkipped(); // @todo ID 8 is a page in Data Set 1
+                $permalink = get_attachment_link(8);
+                $this->http($permalink);
+                $this->assertQueryTrue('is_attachment', 'is_singular');
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+}
+
+class TestWPQueryVerbosePageRules extends TestWPQueryVars {
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                $wp_rewrite->set_permalink_structure('/%author%/%year%/%postname%/');
+                create_initial_taxonomies();
+                $wp_rewrite->flush_rules();
+        }
+}
+
+?>
</ins><span class="cx">Property changes on: wp-testcase/test_query.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_query_resultsphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_query_results.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_shortcodephp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_shortcode.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_uploadsphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_uploads.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_userphp"></a>
<div class="modfile"><h4>Modified: wp-testcase/test_user.php (365 => 366)</h4>
<pre class="diff"><span>
<span class="info">--- wp-testcase/test_user.php        2011-06-03 05:17:22 UTC (rev 365)
+++ wp-testcase/test_user.php        2011-06-05 07:25:21 UTC (rev 366)
</span><span class="lines">@@ -1,172 +1,172 @@
</span><del>-<?php
-
-// test functions in wp-includes/user.php
-
-class TestWPUser extends _WPEmptyBlog {
-
-        var $user_ids = array();
-
-        function setUp() {
-                parent::setUp();
-                // keep track of users we create
-                $user_ids = array();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // delete any users that were created during tests
-                foreach ($this->user_ids as $id)
-                        wp_delete_user($id);
-        }
-
-        function test_get_users_of_blog() {
-                // add one of each user role
-                $user_role = array();
-                foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $role) {
-                        $id = $this->_make_user($role);
-                        $user_role[$id] = $role;
-                }
-
-                $user_list = get_users_of_blog();
-
-                // find the role of each user as returned by get_users_of_blog
-                $found = array();
-                foreach ($user_list as $user) {
-                        // only include the users we just created - there might be some others that existed previously
-                        if (isset($user_role[$user->user_id])) {
-                                $roles = array_keys(unserialize($user->meta_value));
-                                $found[$user->user_id] = $roles[0];
-                        }
-                }
-
-                // make sure every user we created was returned
-                $this->assertEquals($user_role, $found);
-
-        }
-
-        // simple get/set tests for user_option functions
-        function test_user_option() {
-
-                $key = rand_str();
-                $val = rand_str();
-
-                $user_id = $this->_make_user('author');
-
-                // get an option that doesn't exist
-                $this->assertFalse(get_user_option($key, $user_id));
-
-                // set and get
-                update_user_option( $user_id, $key, $val );
-                $this->assertEquals( $val, get_user_option($key, $user_id) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_user_option( $user_id, $key, $val2 );
-                $this->assertEquals( $val2, get_user_option($key, $user_id) );
-
-        }
-
-        // simple tests for usermeta functions
-        function test_usermeta() {
-
-                $key = rand_str();
-                $val = rand_str();
-
-                $user_id = $this->_make_user('author');
-
-                // get a meta key that doesn't exist
-                $this->assertEquals( '', get_usermeta($user_id, $key) );
-
-                // set and get
-                update_usermeta( $user_id, $key, $val );
-                $this->assertEquals( $val, get_usermeta($user_id, $key) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_usermeta( $user_id, $key, $val2 );
-                $this->assertEquals( $val2, get_usermeta($user_id, $key) );
-
-                // delete and get
-                delete_usermeta( $user_id, $key );
-                $this->assertEquals( '', get_usermeta($user_id, $key) );
-
-                // delete by key AND value
-                update_usermeta( $user_id, $key, $val );
-                // incorrect key: key still exists
-                delete_usermeta( $user_id, $key, rand_str() );
-                $this->assertEquals( $val, get_usermeta($user_id, $key) );
-                // correct key: deleted
-                delete_usermeta( $user_id, $key, $val );
-                $this->assertEquals( '', get_usermeta($user_id, $key) );
-
-        }
-
-        // test usermeta functions in array mode
-        function test_usermeta_array() {
-
-                // some values to set
-                $vals = array(
-                        rand_str() => 'val-'.rand_str(),
-                        rand_str() => 'val-'.rand_str(),
-                        rand_str() => 'val-'.rand_str(),
-                );
-
-                $user_id = $this->_make_user('author');
-
-                // there is already some stuff in the array
-                $this->assertTrue(is_array(get_usermeta($user_id)));
-                
-                foreach ($vals as $k=>$v)
-                        update_usermeta( $user_id, $k, $v );
-                
-                // get the complete usermeta array
-                $out = get_usermeta($user_id);
-
-                // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
-                // so we'll just check to make sure our values are included somewhere.
-                foreach ($vals as $v)
-                        $this->assertTrue(in_array($v, $out));
-                        
-                // delete one key and check again
-                $key_to_delete = array_pop(array_keys($vals));
-                delete_usermeta($user_id, $key_to_delete);
-                $out = get_usermeta($user_id);
-                // make sure that key is excluded from the results
-                foreach ($vals as $k=>$v) {
-                        if ($k == $key_to_delete)
-                                $this->assertFalse(in_array($v, $out));
-                        else
-                                $this->assertTrue(in_array($v, $out));
-                }
-        }
-
-        // simple test for user dropdown
-        function test_wp_dropdown_users() {
-                // mu doesn't have this function?
-                if (!is_callable('wp_dropdown_users'))
-                        return $this->markTestSkipped();
-
-                // add some users
-                foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $role) {
-                        $id = $this->_make_user($role, "test-{$role}");
-                        $user[] = $id;
-                }
-
-                $expected = <<<EOF
-<select name='user' id='user' class=''>
-<option value='1'>{$this->author->display_name}</option>
-<option value='{$user[0]}'>test-administrator</option>
-<option value='{$user[1]}'>test-editor</option>
-<option value='{$user[2]}'>test-author</option>
-<option value='{$user[3]}'>test-contributor</option>
-<option value='{$user[4]}'>test-subscriber</option>
-</select>
-EOF;
-
-                $out = wp_dropdown_users('echo=0&orderby=ID');
-
-                $this->assertEquals(strip_ws($expected), strip_ws($out));
-        }
-}
-
-?>
</del><ins>+<?php
+
+// test functions in wp-includes/user.php
+
+class TestWPUser extends _WPEmptyBlog {
+
+        var $user_ids = array();
+
+        function setUp() {
+                parent::setUp();
+                // keep track of users we create
+                $user_ids = array();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                // delete any users that were created during tests
+                foreach ($this->user_ids as $id)
+                        wp_delete_user($id);
+        }
+
+        function test_get_users_of_blog() {
+                // add one of each user role
+                $user_role = array();
+                foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $role) {
+                        $id = $this->_make_user($role);
+                        $user_role[$id] = $role;
+                }
+
+                $user_list = get_users_of_blog();
+
+                // find the role of each user as returned by get_users_of_blog
+                $found = array();
+                foreach ($user_list as $user) {
+                        // only include the users we just created - there might be some others that existed previously
+                        if (isset($user_role[$user->user_id])) {
+                                $roles = array_keys(unserialize($user->meta_value));
+                                $found[$user->user_id] = $roles[0];
+                        }
+                }
+
+                // make sure every user we created was returned
+                $this->assertEquals($user_role, $found);
+
+        }
+
+        // simple get/set tests for user_option functions
+        function test_user_option() {
+
+                $key = rand_str();
+                $val = rand_str();
+
+                $user_id = $this->_make_user('author');
+
+                // get an option that doesn't exist
+                $this->assertFalse(get_user_option($key, $user_id));
+
+                // set and get
+                update_user_option( $user_id, $key, $val );
+                $this->assertEquals( $val, get_user_option($key, $user_id) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_user_option( $user_id, $key, $val2 );
+                $this->assertEquals( $val2, get_user_option($key, $user_id) );
+
+        }
+
+        // simple tests for usermeta functions
+        function test_usermeta() {
+
+                $key = rand_str();
+                $val = rand_str();
+
+                $user_id = $this->_make_user('author');
+
+                // get a meta key that doesn't exist
+                $this->assertEquals( '', get_usermeta($user_id, $key) );
+
+                // set and get
+                update_usermeta( $user_id, $key, $val );
+                $this->assertEquals( $val, get_usermeta($user_id, $key) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_usermeta( $user_id, $key, $val2 );
+                $this->assertEquals( $val2, get_usermeta($user_id, $key) );
+
+                // delete and get
+                delete_usermeta( $user_id, $key );
+                $this->assertEquals( '', get_usermeta($user_id, $key) );
+
+                // delete by key AND value
+                update_usermeta( $user_id, $key, $val );
+                // incorrect key: key still exists
+                delete_usermeta( $user_id, $key, rand_str() );
+                $this->assertEquals( $val, get_usermeta($user_id, $key) );
+                // correct key: deleted
+                delete_usermeta( $user_id, $key, $val );
+                $this->assertEquals( '', get_usermeta($user_id, $key) );
+
+        }
+
+        // test usermeta functions in array mode
+        function test_usermeta_array() {
+
+                // some values to set
+                $vals = array(
+                        rand_str() => 'val-'.rand_str(),
+                        rand_str() => 'val-'.rand_str(),
+                        rand_str() => 'val-'.rand_str(),
+                );
+
+                $user_id = $this->_make_user('author');
+
+                // there is already some stuff in the array
+                $this->assertTrue(is_array(get_usermeta($user_id)));
+                
+                foreach ($vals as $k=>$v)
+                        update_usermeta( $user_id, $k, $v );
+                
+                // get the complete usermeta array
+                $out = get_usermeta($user_id);
+
+                // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
+                // so we'll just check to make sure our values are included somewhere.
+                foreach ($vals as $v)
+                        $this->assertTrue(in_array($v, $out));
+                        
+                // delete one key and check again
+                $key_to_delete = array_pop(array_keys($vals));
+                delete_usermeta($user_id, $key_to_delete);
+                $out = get_usermeta($user_id);
+                // make sure that key is excluded from the results
+                foreach ($vals as $k=>$v) {
+                        if ($k == $key_to_delete)
+                                $this->assertFalse(in_array($v, $out));
+                        else
+                                $this->assertTrue(in_array($v, $out));
+                }
+        }
+
+        // simple test for user dropdown
+        function test_wp_dropdown_users() {
+                // mu doesn't have this function?
+                if (!is_callable('wp_dropdown_users'))
+                        return $this->markTestSkipped();
+
+                // add some users
+                foreach (array('administrator', 'editor', 'author', 'contributor', 'subscriber') as $role) {
+                        $id = $this->_make_user($role, "test-{$role}");
+                        $user[] = $id;
+                }
+
+                $expected = <<<EOF
+<select name='user' id='user' class=''>
+<option value='1'>{$this->author->display_name}</option>
+<option value='{$user[0]}'>test-administrator</option>
+<option value='{$user[1]}'>test-editor</option>
+<option value='{$user[2]}'>test-author</option>
+<option value='{$user[3]}'>test-contributor</option>
+<option value='{$user[4]}'>test-subscriber</option>
+</select>
+EOF;
+
+                $out = wp_dropdown_users('echo=0&orderby=ID');
+
+                $this->assertEquals(strip_ws($expected), strip_ws($out));
+        }
+}
+
+?>
</ins><span class="cx">Property changes on: wp-testcase/test_user.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="wptestcasetest_user_capabilitiesphp"></a>
<div class="propset"><h4>Property changes: wp-testcase/test_user_capabilities.php</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
</div>
</body>
</html>