<!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>[Tests][875] trunk: Rename the unit tests wp-config.php to wp-tests-config.php.</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><a href="http://unit-tests.trac.wordpress.org/changeset/875">875</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-03 17:24:03 +0000 (Tue, 03 Jul 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename the unit tests wp-config.php to wp-tests-config.php. Also:
* Rename wp-testdata to data
* Rename wp-testlib to includes
* Rename wp-testcase to tests
* Begin to remove files from the old test suite we no longer need to port code from
fixes <a href="http://unit-tests.trac.wordpress.org/ticket/98">#98</a>. see <a href="http://unit-tests.trac.wordpress.org/ticket/42">#42</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbininstallphp">trunk/bin/install.php</a></li>
<li><a href="#trunkbootstrapphp">trunk/bootstrap.php</a></li>
<li><a href="#trunkphpunitxml">trunk/phpunit.xml</a></li>
<li><a href="#trunkteststest_httpphp">trunk/tests/test_http.php</a></li>
<li><a href="#trunkteststest_import_wpphp">trunk/tests/test_import_wp.php</a></li>
<li><a href="#trunkteststest_includes_functionsphp">trunk/tests/test_includes_functions.php</a></li>
<li><a href="#trunkteststest_post_outputphp">trunk/tests/test_post_output.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/data/</li>
<li>trunk/includes/</li>
<li>trunk/tests/</li>
<li><a href="#trunkwptestsconfigsamplephp">trunk/wp-tests-config-sample.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkdatasample_blogsphp">trunk/data/sample_blogs.php</a></li>
<li><a href="#trunkincludesbasephp">trunk/includes/base.php</a></li>
<li><a href="#trunkincludesgetoptphp">trunk/includes/getopt.php</a></li>
<li><a href="#trunkwpconfigsamplephp">trunk/wp-config-sample.php</a></li>
<li>trunk/wp-testcase/</li>
<li>trunk/wp-testdata/</li>
<li>trunk/wp-testlib/</li>
<li><a href="#trunkwptestsh">trunk/wptest.sh</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/bin/install.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bin/install.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/bin/install.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx">
</span><span class="cx"> define( 'WP_INSTALLING', true );
</span><span class="cx"> require_once $config_file_path;
</span><del>-require_once $config_dir . '/wp-testlib/functions.php';
</del><ins>+require_once $config_dir . '/includes/functions.php';
</ins><span class="cx">
</span><span class="cx"> $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
</span><span class="cx"> $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
</span></span></pre></div>
<a id="trunkbootstrapphp"></a>
<div class="modfile"><h4>Modified: trunk/bootstrap.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bootstrap.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/bootstrap.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx">
</span><span class="cx"> require_once 'PHPUnit/Autoload.php';
</span><span class="cx">
</span><del>-$config_file_path = dirname( __FILE__ ) . '/wp-config.php';
</del><ins>+$config_file_path = dirname( __FILE__ ) . '/wp-tests-config.php';
</ins><span class="cx">
</span><span class="cx"> /*
</span><span class="cx"> * Globalize some WordPress variables, because PHPUnit loads this file inside a function
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx">
</span><span class="cx"> require_once $config_file_path;
</span><span class="cx">
</span><del>-define( 'DIR_TESTDATA', dirname( __FILE__ ) . '/wp-testdata' );
</del><ins>+define( 'DIR_TESTDATA', dirname( __FILE__ ) . '/data' );
</ins><span class="cx">
</span><span class="cx"> if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) )
</span><span class="cx">         define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">         $GLOBALS['base'] = '/';
</span><span class="cx"> }
</span><span class="cx">
</span><del>-require dirname( __FILE__ ) . '/wp-testlib/functions.php';
</del><ins>+require dirname( __FILE__ ) . '/includes/functions.php';
</ins><span class="cx">
</span><span class="cx"> // Preset WordPress options defined in bootstrap file.
</span><span class="cx"> // Used to activate themes, plugins, as well as other settings.
</span><span class="lines">@@ -67,8 +67,8 @@
</span><span class="cx"> // Delete any default posts & related data
</span><span class="cx"> _delete_all_posts();
</span><span class="cx">
</span><del>-require dirname( __FILE__ ) . '/wp-testlib/testcase.php';
-require dirname( __FILE__ ) . '/wp-testlib/testcase-xmlrpc.php';
-require dirname( __FILE__ ) . '/wp-testlib/testcase-ajax.php';
-require dirname( __FILE__ ) . '/wp-testlib/exceptions.php';
-require dirname( __FILE__ ) . '/wp-testlib/utils.php';
</del><ins>+require dirname( __FILE__ ) . '/includes/testcase.php';
+require dirname( __FILE__ ) . '/includes/testcase-xmlrpc.php';
+require dirname( __FILE__ ) . '/includes/testcase-ajax.php';
+require dirname( __FILE__ ) . '/includes/exceptions.php';
+require dirname( __FILE__ ) . '/includes/utils.php';
</ins></span></pre></div>
<a id="trunkdatasample_blogsphp"></a>
<div class="delfile"><h4>Deleted: trunk/data/sample_blogs.php (861 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testdata/sample_blogs.php        2012-07-02 11:00:45 UTC (rev 861)
+++ trunk/data/sample_blogs.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,107 +0,0 @@
</span><del>-<?php
-
-// extend these classes to start with common test cases
-// don't forget to call parent::setUp() and parent::tearDown() if you override them
-
-// an empty blog
-class _WPEmptyBlog extends WPTestCase {
-        var $post_ids = array();
-        var $_setup_check = false;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->author = get_user_by( 'login', WP_USER_NAME );
-                $this->_delete_all_posts();
-                update_option('home', 'http://example.com');
-                update_option('siteurl', 'http://example.com');
-                delete_option('permalink_structure');
-                // clear out some caching stuff that's likely to cause unexpected results
-                unset($GLOBALS['cache_lastpostmodified']);
-                $this->_setup_check = true;
-        }
-
-        function test_setup_check() {
-                // it's easy to forget to call parent::setUp() when extending a base test class
-                // this checks to make sure the base class setUp() was run
-                $this->assertTrue($this->_setup_check, get_class($this).' did not call parent::setUp()');
-        }
-}
-
-// a blog with 10 posts
-class _WPSmallBlog extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                $this->_insert_quick_posts(10);
-        }
-}
-
-// a blog with 25 posts and 5 pages
-class _WPMediumBlog extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                $this->_insert_quick_posts(25);
-        }
-}
-
-// a quick way to construct a blog from a WXR export file
-class _WPImportBlog extends _WPEmptyBlog {
-        var $import_filename = NULL;
-
-        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';
-                $this->_import_wp( DIR_TESTDATA.'/'.$this->import_filename );
-        }
-}
-
-// a faster way to get the asdftestblog1 dataset than using the importer
-class _WPDataset1 extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                $this->_nuke_main_tables();
-                $this->_load_sql_dump(DIR_TESTDATA.'/export/asdftestblog1.2007-11-23.sql');
-        }
-        
-        function tearDown() {
-                $this->_nuke_main_tables();
-                parent::tearDown();
-        }
-        
-        function _nuke_main_tables() {
-                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}");
-        }
-}
-
-// a faster way to get the Theme Test Data(test-data.2011-01-17.xml) dataset than using the importer
-class _WPDataset2 extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                $this->_nuke_main_tables();
-                $this->_load_sql_dump(DIR_TESTDATA . '/export/test-data.2011-01-17.sql');
-        }
-        
-        function tearDown() {
-                $this->_nuke_main_tables();
-                parent::tearDown();
-        }
-        
-        function _nuke_main_tables() {
-                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}");
-        }
-}
-
-?>
</del></span></pre></div>
<a id="trunkincludesbasephp"></a>
<div class="delfile"><h4>Deleted: trunk/includes/base.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testlib/base.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/includes/base.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,674 +0,0 @@
</span><del>-<?php
-
-// abstract most of the unit test framework stuff, so we're not too dependent on one particular test library
-
-#require_once('PHPUnit.php');
-require_once('PHPUnit/Autoload.php');
-require_once('PHPUnit/Util/ErrorHandler.php');
-
-// test cases should extend WPTestCase instead of PHPUnit_TestCase for three reasons:
-
-// 1. it makes it easier to switch to a different unit test framework if necessary
-// 2. you get a bunch of helper methods (see below)
-// 3. The wp-test runner only runs tests that inherit from WPTestCase
-
-class WPTestCase extends PHPUnit_Framework_TestCase {
-
-        protected $backupGlobals = FALSE;
-        var $_time_limit = 120; // max time in seconds for a single test function
-        
-        /**
-         * Whenever a track ticket is checked to see if it's closed or not
-         * the results are stored here
-         * @var array
-         */
-        protected static $trac_ticket_cache = array();
-
-        function setUp() {
-                // error types taken from PHPUnit_Framework_TestResult::run
-                $this->_phpunit_err_mask = E_USER_ERROR | E_NOTICE | E_STRICT;
-                $this->_old_handler = set_error_handler(array(&$this, '_error_handler'));
-                if (is_null($this->_old_handler)) {
-                        restore_error_handler();
-                }
-                _enable_wp_die();
-
-                set_time_limit($this->_time_limit);
-        }
-
-        function tearDown() {
-                // Multi-level flush, when necessary, if a test did not clean up after themselves.
-                // Avoid flushing the main PHPUnit buffer.
-                $levels = ob_get_level();
-                for ( $i = 1; $i < $levels; $i++ )
-                        ob_end_flush();
-
-                if (!is_null($this->_old_handler)) {
-                        restore_error_handler();
-                }
-                _enable_wp_die();
-        }
-
-        /**
-         * Treat any error, which wasn't handled by PHPUnit as a failure
-         */
-        function _error_handler($errno, $errstr, $errfile, $errline) {
-                // @ in front of statement
-                if (error_reporting() == 0) {
-                        return;
-                }
-                // notices and strict warnings are passed on to the phpunit error handler but don't trigger an exception
-                if ($errno | $this->_phpunit_err_mask) {
-                        PHPUnit_Util_ErrorHandler::handleError($errno, $errstr, $errfile, $errline);
-                }
-                // warnings and errors trigger an exception, which is included in the test results
-                else {
-                        error_log("Testing: $errstr in $errfile on line $errline");
-                        //TODO: we should raise custom exception here, sth like WP_PHPError
-                        throw new PHPUnit_Framework_Error(
-                                $errstr,
-                                $errno,
-                                $errfile,
-                                $errline,
-                                $trace
-                        );
-                }
-        }
-
-        function _query_filter($q) {
-                $now = microtime(true);
-                $delta = $now - $this->_q_ts;
-                $this->_q_ts = $now;
-
-                $bt = debug_backtrace();
-                $caller = '';
-                foreach ($bt as $trace) {
-                        if (strtolower(@$trace['class']) == 'wpdb')
-                                continue;
-                        elseif (strtolower(@$trace['function']) == __FUNCTION__)
-                                continue;
-                        elseif (strtolower(@$trace['function']) == 'call_user_func_array')
-                                continue;
-                        elseif (strtolower(@$trace['function']) == 'apply_filters')
-                                continue;
-
-                        $caller = $trace['function'];
-                        break;
-                }
-
-                #$this->_queries[] = array($caller, $q);
-                $delta = sprintf('%0.6f', $delta);
-                echo "{$delta} {$caller}: {$q}\n";
-                @++$this->_queries[$caller];
-                return $q;
-        }
-
-        // call these to record and display db queries
-        function record_queries() {
-                #$this->_queries = array();
-                #$this->_q_ts = microtime(true);
-                #add_filter('query', array(&$this, '_query_filter'));
-                #define('SAVEQUERIES', true);
-                global $wpdb;
-                $wpdb->queries = array();
-        }
-
-        function dump_queries() {
-                #remove_filter('query', array(&$this, '_query_filter'));
-                #asort($this->_queries);
-                #dmp($this->_queries);
-                #$this->_queries = array();
-                global $wpdb;
-                dmp($wpdb->queries);
-        }
-
-        function dump_query_summary() {
-                $out = array();
-                global $wpdb;
-                foreach ($wpdb->queries as $q) {
-                                @$out[$q[2]][0] += 1; // number of queries
-                                @$out[$q[2]][1] += $q[1]; // query time
-                }
-                dmp($out);
-        }
-
-        // pretend that a given URL has been requested
-        function http($url) {
-                // note: the WP and WP_Query classes like to silently fetch parameters
-                // from all over the place (globals, GET, etc), which makes it tricky
-                // to run them more than once without very carefully clearing everything
-                $_GET = $_POST = array();
-                foreach (array('query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow') as $v)
-                        unset($GLOBALS[$v]);
-                $parts = parse_url($url);
-                if (isset($parts['scheme'])) {
-                        $req = $parts['path'];
-                        if (isset($parts['query'])) {
-                                $req .= '?' . $parts['query'];
-                                // parse the url query vars into $_GET
-                                parse_str($parts['query'], $_GET);
-                        }
-                }
-                else {
-                        $req = $url;
-                }
-
-                $_SERVER['REQUEST_URI'] = $req;
-                unset($_SERVER['PATH_INFO']);
-
-                wp_cache_flush();
-                unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
-                $GLOBALS['wp_the_query'] =& new WP_Query();
-                $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
-                $GLOBALS['wp'] =& new WP();
-
-                // clean out globals to stop them polluting wp and wp_query
-                foreach ($GLOBALS['wp']->public_query_vars as $v) {
-                        unset($GLOBALS[$v]);
-                }
-                foreach ($GLOBALS['wp']->private_query_vars as $v) {
-                        unset($GLOBALS[$v]);
-                }
-
-                $GLOBALS['wp']->main($parts['query']);
-        }
-
-        // various helper functions for creating and deleting posts, pages etc
-
-        // as it suggests: delete all posts and pages
-        function _delete_all_posts() {
-                global $wpdb;
-
-                $all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}");
-                if ($all_posts) {
-                        foreach ($all_posts as $id)
-                                wp_delete_post( $id, true );
-                }
-        }
-
-        // insert a given number of trivial posts, each with predictable title, content and excerpt
-        function _insert_quick_posts($num, $type='post', $more = array()) {
-                for ($i=0; $i<$num; $i++)
-                        $this->post_ids[] = wp_insert_post(array_merge(array(
-                                'post_author' => $this->author->ID,
-                                'post_status' => 'publish',
-                                'post_title' => "{$type} title {$i}",
-                                'post_content' => "{$type} content {$i}",
-                                'post_excerpt' => "{$type} excerpt {$i}",
-                                'post_type' => $type
-                                ), $more));
-        }
-
-        function _insert_quick_comments($post_id, $num=3) {
-                for ($i=0; $i<$num; $i++) {
-                        wp_insert_comment(array(
-                                'comment_post_ID' => $post_id,
-                                'comment_author' => "Commenter $i",
-                                'comment_author_url' => "http://example.com/$i/",
-                                'comment_approved' => 1,
-                                ));
-                }
-        }
-
-        // insert a given number of trivial pages, each with predictable title, content and excerpt
-        function _insert_quick_pages($num, $more = array()) {
-                $this->_insert_quick_posts($num, 'page', $more);
-        }
-
-        /**
-         * Import a WXR file.
-         *
-         * The $users parameter provides information on how users specified in the import
-         * file should be imported. Each key is a user login name and indicates if the user
-         * should be mapped to an existing user, created as a new user with a particular login
-         * or imported with the information held in the WXR file. An example of this:
-         *
-         * <code>
-         * $users = array(
-         * 'alice' => 1, // alice will be mapped to user ID 1
-         * 'bob' => 'john', // bob will be transformed into john
-         * 'eve' => false // eve will be imported as is
-         * );</code>
-         *
-         * @param string $filename Full path of the file to import
-         * @param array $users User import settings
-         * @param bool $fetch_files Whether or not do download remote attachments
-         */
-        function _import_wp( $filename, $users = array(), $fetch_files = true ) {
-                $importer = new WP_Import();
-                $file = realpath( $filename );
-                assert('!empty($file)');
-                assert('is_file($file)');
-
-                $authors = $mapping = array();
-                $i = 0;
-
-                // each user is either mapped to a given ID, mapped to a new user
-                // with given login or imported using details in WXR file
-                foreach ( $users as $user => $map ) {
-                        $authors[$i] = $user;
-                        if ( is_int( $map ) )
-                                $mapping[$i] = $map;
-                        else if ( is_string( $map ) )
-                                $new[$i] = $map;
-
-                        $i++;
-                }
-
-                $_POST = array( 'imported_authors' => $authors, 'user_map' => $mapping, 'user_new' => $new );
-
-                ob_start();
-                $importer->fetch_attachments = $fetch_files;
-                $importer->import( $file );
-                ob_end_clean();
-
-                $_POST = array();
-        }
-
-        // Generate PHP source code containing unit tests for the current blog contents.
-        // When run, the tests will check that the content of the blog exactly matches what it is now,
-        // with a separate test function for each post.
-        function _generate_post_content_test(&$posts, $separate_funcs = true) {
-                global $wpdb;
-
-                $out = '';
-                if (!$separate_funcs)
-                        $out .= "\n\tfunction test_all_posts() {\n";
-                foreach ($posts as $i=>$post) {
-                        if ($separate_funcs)
-                                $out .= "\n\tfunction test_post_{$i}() {\n";
-                        $out .= "\t\t\$post = \$this->posts[{$i}];\n";
-                        foreach (array_keys(get_object_vars($post)) as $field) {
-                                if ($field == 'guid') {
-                                        if ($post->post_type == 'attachment')
-                                                $out .= "\t\t".'$this->assertEquals(wp_get_attachment_url($post->ID), $post->guid);'."\n";
-                                        else
-                                                $out .= "\t\t".'$this->assertEquals("'.addcslashes($post->guid, "\$\n\r\t\"\\").'", $post->guid);'."\n";
-                                }
-                                elseif ($field == 'post_parent' and !empty($post->post_parent)) {
-                                        $parent_index = 0;
-                                        foreach (array_keys($posts) as $index) {
-                                                if ( $posts[$index]->ID == $post->post_parent ) {
-                                                        $parent_index = $index;
-                                                        break;
-                                                }
-                                        }
-                                        $out .= "\t\t".'$this->assertEquals($this->posts['.$parent_index.']->ID, $post->post_parent);'."\n";
-                                }
-                                elseif ($field == 'post_author')
-                                        $out .= "\t\t".'$this->assertEquals(get_profile(\'ID\', \''.($wpdb->get_var("SELECT user_login FROM {$wpdb->users} WHERE ID={$post->post_author}")).'\'), $post->post_author);'."\n";
-                                elseif ($field != 'ID')
-                                        $out .= "\t\t".'$this->assertEquals("'.addcslashes($post->$field, "\$\n\r\t\"\\").'", $post->'.$field.');'."\n";
-                        }
-                        $cats = wp_get_post_categories($post->ID, array('fields'=>'all'));
-                        $out .= "\t\t".'$cats = wp_get_post_categories($post->ID, array("fields"=>"all"));'."\n";
-                        $out .= "\t\t".'$this->assertEquals('.count($cats).', count($cats));'."\n";
-                        if ($cats) {
-                                foreach ($cats as $j=>$cat) {
-                                        $out .= "\t\t".'$this->assertEquals(\''.addslashes($cat->name).'\', $cats['.$j.']->name);'."\n";
-                                        $out .= "\t\t".'$this->assertEquals(\''.addslashes($cat->slug).'\', $cats['.$j.']->slug);'."\n";
-                                }
-                        }
-
-                        $tags = wp_get_post_tags($post->ID);
-                        $out .= "\t\t".'$tags = wp_get_post_tags($post->ID);'."\n";
-                        $out .= "\t\t".'$this->assertEquals('.count($tags).', count($tags));'."\n";
-                        if ($tags) {
-                                foreach ($tags as $j=>$tag) {
-                                        $out .= "\t\t".'$this->assertEquals(\''.addslashes($tag->name).'\', $tags['.$j.']->name);'."\n";
-                                        $out .= "\t\t".'$this->assertEquals(\''.addslashes($tag->slug).'\', $tags['.$j.']->slug);'."\n";
-                                }
-                        }
-
-                        $meta = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE post_id = $post->ID");
-                        #$out .= "\t\t".'$this->assertEquals('.count($postmeta).', count($meta));'."\n";
-                        foreach ($meta as $m) {
-                                #$out .= "\t\t".'$meta = get_post_meta($post->ID, \''.addslashes($m->meta_key).'\', true);'."\n";
-                                $out .= "\t\t".'$this->assertEquals('.var_export(get_post_meta($post->ID, $m->meta_key, false), true).', get_post_meta($post->ID, \''.addslashes($m->meta_key).'\', false));'."\n";
-                        }
-
-
-                        $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_date DESC", $post->ID));
-
-                        $out .= "\t\t".'$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d ORDER BY comment_date DESC", $post->ID));'."\n";
-                        $out .= "\t\t".'$this->assertEquals('.count($comments).', count($comments));'."\n";
-                        foreach ($comments as $k=>$comment) {
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_author).'\', $comments['.$k.']->comment_author);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_author_email).'\', $comments['.$k.']->comment_author_email);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_author_url).'\', $comments['.$k.']->comment_author_url);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_author_IP).'\', $comments['.$k.']->comment_author_IP);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_date).'\', $comments['.$k.']->comment_date);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_date_gmt).'\', $comments['.$k.']->comment_date_gmt);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_karma).'\', $comments['.$k.']->comment_karma);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_approved).'\', $comments['.$k.']->comment_approved);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_agent).'\', $comments['.$k.']->comment_agent);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_type).'\', $comments['.$k.']->comment_type);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_parent).'\', $comments['.$k.']->comment_parent);'."\n";
-                                $out .= "\t\t".'$this->assertEquals(\''.addslashes($comment->comment_user_id).'\', $comments['.$k.']->comment_user_id);'."\n";
-                        }
-
-
-                        if ($separate_funcs)
-                                $out .= "\t}\n\n";
-                        else
-                                $out .= "\n\n";
-                }
-                if (!$separate_funcs)
-                        $out .= "\t}\n\n";
-                return $out;
-        }
-
-        function _dump_tables($table /*, table2, .. */) {
-                $args = func_get_args();
-                $table_list = join(' ', $args);
-                system('mysqldump -u '.DB_USER.' --password='.DB_PASSWORD.' -cqnt '.DB_NAME.' '.$table_list);
-        }
-
-        function _load_sql_dump($file) {
-                $lines = file($file);
-
-                global $wpdb;
-                foreach ($lines as $line) {
-                        $line = trim( $line );
-                        if ( empty( $line ) || 0 === strpos( $line, '--' ) || 0 === strpos( $line, '/*' ) )
-                                continue;
-                        $wpdb->query($line);
-                }
-        }
-
-        // add a user of the specified type
-        function _make_user($role = 'administrator', $user_login = '', $pass='', $email='') {
-                if (!$user_login)
-                        $user_login = rand_str();
-                if (!$pass)
-                        $pass = rand_str();
-                if (!$email)
-                        $email = rand_str().'@example.com';
-
-                // we're testing via the add_user()/edit_user() functions, which expect POST data
-                $_POST = array(
-                        // 'role' => $role, Set this later
-                        'user_login' => $user_login,
-                        'pass1' => $pass,
-                        'pass2' => $pass,
-                        'email' => $email,
-                        'description' => $user_login,
-                );
-
-                $this->user_ids[] = $id = add_user();
-
-                $user = new WP_User( $id );
-                $user->set_role( $role );
-
-                $_POST = array();
-                return $id;
-        }
-
-        function _destroy_user( $user_id ) {
-                if ( is_multisite() )
-                        wpmu_delete_user( $user_id );
-                else
-                        wp_delete_user( $user_id );
-        }
-
-        function _destroy_users() {
-                array_map( array( $this, '_destroy_user' ), $this->user_ids );
-        }
-
-        function _destroy_uploads() {
-                $uploads = wp_upload_dir();
-                foreach ( scandir( $uploads['basedir'] ) as $file )
-                        _rmdir( $uploads['basedir'] . '/' . $file );
-        }
-
-        /**
-         * Checks if track ticket #$ticket_id is resolved
-         *
-         * @return bool|null true if the ticket is resolved, false if not resolved, null on error
-         */
-        function isTracTicketClosed($trac_url, $ticket_id) {
-                $trac_url = rtrim($trac_url, '/');
-                $url = "$trac_url/ticket/$ticket_id?format=tab";                
-                if ( array_key_exists( $url, self::$trac_ticket_cache ) ) {
-                        return self::$trac_ticket_cache[$url];
-                }
-                $ticket_tsv = file_get_contents($url);                
-                if (false === $ticket_tsv) {
-                        self::$trac_ticket_cache[$url] = null;
-                        return self::$trac_ticket_cache[$url];
-                }
-                $lines = explode("\n", $ticket_tsv, 2);
-                if (!is_array($lines) || count($lines) < 2) {
-                        self::$trac_ticket_cache[$url] = null;
-                        return self::$trac_ticket_cache[$url];
-                }
-                $titles = str_getcsv( $lines[0], "\t" );
-                $status_idx = array_search('status', $titles);
-                if (false === $status_idx) {
-                        self::$trac_ticket_cache[$url] = null;
-                        return self::$trac_ticket_cache[$url];
-                }
-                $tabs = str_getcsv( $lines[1], "\t" );
-                self::$trac_ticket_cache[$url] = ( 'closed' === $tabs[$status_idx] );
-                return self::$trac_ticket_cache[$url];
-        }
-
-        /**
-         * Skips the current test if there is open WordPress ticket with id $ticket_id
-         */
-        function knownWPBug($ticket_id) {
-                if (!TEST_FORCE_KNOWN_BUGS && (TEST_SKIP_KNOWN_BUGS || !$this->isTracTicketClosed('http://core.trac.wordpress.org', $ticket_id))) {
-                        $this->markTestSkipped( sprintf('WordPress Ticket #%d is not fixed', $ticket_id) );
-                }
-        }
-
-        /**
-         * Skips the current test if there is open unit tests ticket with id $ticket_id
-         */
-        function knownUTBug($ticket_id) {
-                if (!TEST_FORCE_KNOWN_BUGS && (TEST_SKIP_KNOWN_BUGS || !$this->isTracTicketClosed('http://unit-tests.trac.wordpress.org', $ticket_id))) {
-                        $this->markTestSkipped( sprintf('Unit Tests Ticket #%d is not fixed', $ticket_id) );
-                }
-        }
-
-        /**
-         * Skips the current test if there is open WordPress MU ticket with id $ticket_id
-         */
-        function knownMUBug($ticket_id) {
-                if (!TEST_FORCE_KNOWN_BUGS && (TEST_SKIP_KNOWN_BUGS || !$this->isTracTicketClosed('http://trac.mu.wordpress.org', $ticket_id))) {
-                        $this->markTestSkipped( sprintf('WordPress MU Ticket #%d is not fixed', $ticket_id) );
-                }
-        }
-
-        /**
-         * Skips the current test if there is open plugin ticket with id $ticket_id
-         */
-        function knownPluginBug($ticket_id) {
-                if (!TEST_FORCE_KNOWN_BUGS && (TEST_SKIP_KNOWN_BUGS || !$this->isTracTicketClosed('http://dev.wp-plugins.org', $ticket_id))) {
-                        $this->markTestSkipped( sprintf('WordPress Plugin Ticket #%d is not fixed', $ticket_id) );
-                }
-        }
-        /**
-         * Skips the current test if the PHP version is not high enough
-         */
-        function checkAtLeastPHPVersion($ver) {
-                if ( version_compare(PHP_VERSION, $ver, '<') ) {
-                        $this->markTestSkipped();
-                }
-        }
-
-        /**
-         * Skips the current test the given PHP extension is not loaded
-         * @param string $ext the PHP extension name to check
-         * @return void
-         */
-        function checkPHPExtension($ext) {
-                if ( !extension_loaded($ext) ) {
-                        $this->markTestSkipped("The $ext PHP extension is not loaded.");
-                }
-        }
-
-        // convenience function: return the # of posts associated with a tag
-        function _tag_count($name) {
-                $t = get_term_by('name', $name, 'post_tag');
-                if ($t)
-                        return $t->count;
-        }
-
-        // convenience function: return the # of posts associated with a category
-        function _category_count($name) {
-                $t = get_term_by('name', $name, 'category');
-                if ($t)
-                        return $t->count;
-        }
-
-}
-
-// simple functions for loading and running tests
-function wptest_get_all_test_files($dir) {
-        $tests = array();
-        $files = scandir($dir);
-        foreach ( $files as $file ) {
-                if ($file[0] == '.')
-                                continue;
-                // skip test loaders from jacob's tests
-                if (strtolower($file) == 'alltests.php')
-                        continue;
-                // these tests clash with other things
-                if (in_array(strtolower($file), array('testplugin.php', 'testlocale.php')))
-                        continue;
-                $path = realpath($dir . DIRECTORY_SEPARATOR . $file);
-                $fileparts = pathinfo($file);
-                if (is_file($path) and $fileparts['extension'] == 'php')
-                        $tests[] = $path;
-                elseif (is_dir($path))
-                        $tests = array_merge($tests, wptest_get_all_test_files($path));
-        }
-        return $tests;
-}
-
-function wptest_is_descendent($parent, $class) {
-
-        $ancestor = strtolower(get_parent_class($class));
-
-        while ($ancestor) {
-                if ($ancestor == strtolower($parent)) return true;
-                $ancestor = strtolower(get_parent_class($ancestor));
-        }
-
-        return false;
-}
-
-function wptest_get_all_test_cases() {
-        $test_classes = array();
-        $all_classes = get_declared_classes();
-        // only classes that extend WPTestCase and have names that don't start with _ are included
-        foreach ($all_classes as $class)
-                if ($class{0} != '_' and wptest_is_descendent('WPTestCase', $class))
-                        $test_classes[] = $class;
-        return $test_classes;
-}
-
-/**
- * Simple function to list out all the test cases for command line interfaces
- *
- * @param $test_classes The test casses array as returned by wptest_get_all_test_cases()
- * @return none
- */
-function wptest_listall_testcases($test_classes) {
-        echo "\nWordPress Tests available TestCases:\n\n";
-        natcasesort( $test_classes );
-        echo array_reduce($test_classes, '_wptest_listall_testcases_helper');
-        echo "\nUse -t TestCaseName to run individual test cases\n";
-}
-
-function _wptest_listall_testcases_helper( $current, $item ) {
-        return $current . "\t{$item}\n";
-}
-
-function wptest_run_tests($classes, $classnames = array(), $filter = null ) {
-        $suite = new PHPUnit_Framework_TestSuite();
-
-        if ( ! is_array($classnames) ) // For strings, Accept a comma separated list, or a space separated list.
-                $classnames = preg_split('![,\s]+!', $classnames);
-
-        $classnames = array_map('strtolower', $classnames);
-        $classnames = array_filter($classnames); //strip out any empty items
-
-        foreach ( $classes as $testcase ) {
-                if ( ( empty($classnames) || in_array( strtolower( $testcase ), $classnames ) ) &&
-                         ( is_null( $filter ) || strstr( $testcase, $filter ) )
-                        ) {
-                        $suite->addTestSuite($testcase);
-                }
-        }
-
-        #return PHPUnit::run($suite);
-        $result = new PHPUnit_Framework_TestResult;
-        require_once('PHPUnit/TextUI/ResultPrinter.php');
-        $printer = new PHPUnit_TextUI_ResultPrinter(NULL, WP_PHPUNIT_VERBOSE, !stristr(PHP_OS, 'WIN') );
-        $result->addListener($printer);
-        return array($suite->run($result, FALSE ), $printer);
-}
-
-function wptest_print_result($printer, $result) {
-        $printer->printResult($result, timer_stop());
-        /*
-        echo $result->toString();
-        echo "\n", str_repeat('-', 40), "\n";
-        if ($f = intval($result->failureCount()))
-                echo "$f failures\n";
-        if ($e = intval($result->errorCount()))
-                echo "$e errors\n";
-
-        if (!$f and !$e)
-                echo "PASS (".$result->runCount()." tests)\n";
-        else
-                echo "FAIL (".$result->runCount()." tests)\n";
-        */
-}
-
-/**
- * Base class for XML-RPC tests.
- *
- * Initializes XML-RPC server instance and creates set of users.
- */
-abstract class WPXMLRPCServerTestCase extends WPTestCase {
-        var $myxmlrpcserver;
-        var $user_ids = array();
-
-        function setUp() {
-
-                parent::setUp();
-                // keep track of users we create
-                $this->user_ids = array();
-                $this->_flush_roles();
-
-                add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
-
-                $this->_make_user( 'subscriber', 'subscriber', 'subscriber' );
-                $this->_make_user( 'contributor', 'contributor', 'contributor' );
-                $this->_make_user( 'author', 'author', 'author' );
-                $this->_make_user( 'editor', 'editor', 'editor' );
-                $this->_make_user( 'administrator', 'administrator', 'administrator' );
-
-                $this->myxmlrpcserver = new wp_xmlrpc_server();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // delete any users and uploads that were created during tests
-                $this->_destroy_users();
-                $this->_destroy_uploads();
-
-                remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
-        }
-
-        function _flush_roles() {
-                // we want to make sure we're testing against the db, not just in-memory data
-                // this will flush everything and reload it from the db
-                unset( $GLOBALS['wp_user_roles'] );
-        }
-}
-
-?>
</del></span></pre></div>
<a id="trunkincludesgetoptphp"></a>
<div class="delfile"><h4>Deleted: trunk/includes/getopt.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testlib/getopt.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/includes/getopt.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,374 +0,0 @@
</span><del>-<?php
-/**
- * getopt relacement / extenstion
- *
- * prior to PHP 5.3 getopt is not supported on the windows plattform
- * and it does not support long options on other plattforms as well.
- *
- * this file offers a _getopt() function as a replacement. via the
- * php.net manual page for getop().
- *
- * original author is 可愛柚爸 / uberlinuxguy at tulg dot org
- *
- * the function has been taken from that website, and refactored
- * into a helper class to increase the protability
- *
- * @version 1.0 hakre-1
- *
- * CHANGELOG:
- *
- * - refactored the functions into a class (better portability)
- * - reformatted the code (copy & paste issues)
- * - removed eval calls (commented)
- * - smarter quoting
- * - indentation on tab and cleanup of whitespaces
- * - deprecated string access ({}) fixed with [].
- *
- * TODO:
- * (empty)
- *
- *
- * @link http://www.ntu.beautifulworldco.com/weblog/?p=526
- * @link http://www.php.net/getopt
- */
-
-/**
- * getoptParser
- *
- * getopt() compatible argv parsing.
- *
- * @see getoptParser::getopt()
- * @see getoptParser::split_para()
- */
-class getoptParser {
-        /**
-         * getopt()
-         *
-         * Usage: _getopt ( [$flag,] $short_option [, $long_option] );
-         *
-         * Note that another function split_para() is required, which can be
-         * found in the same page.
-         *
-         * _getopt() fully simulates getopt() which is described at
-         * (@see http://us.php.net/manual/en/function.getopt.php} , including long
-         * options for PHP version under 5.3.0. (Prior to 5.3.0, long options was
-         * only available on few systems)
-         *
-         * Besides legacy usage of getopt(), I also added a new option to manipulate
-         * your own argument lists instead of those from command lines. This new
-         * option can be a string or an array such as
-         *
-         * $flag = "-f value_f -ab --required 9 --optional=PK --option -v test -k";
-         *
-         * or
-         *
-         * $flag = array ( "-f", "value_f", "-ab", "--required", "9", "--optional=PK", "--option" );
-         *
-         * So there are four ways to work with _getopt(),
-         *
-         * 1. _getopt ( $short_option );
-         *        it's a legacy usage, same as getopt ( $short_option ).
-         *
-         * 2. _getopt ( $short_option, $long_option );
-         *        it's a legacy usage, same as getopt ( $short_option, $long_option ).
-         *
-         * 3. _getopt ( $flag, $short_option );
-         *        use your own argument lists instead of command line arguments.
-         *
-         * 4. _getopt ( $flag, $short_option, $long_option );
-         *        use your own argument lists instead of command line arguments.
-         *
-         * @version 1.3
-         * @date 2009/05/30 (taken from the website 2010-01-11)
-         * @author 可愛柚爸 / uberlinuxguy at tulg dot org
-         * @see http://www.ntu.beautifulworldco.com/weblog/?p=526
-         *
-         * @params mixed
-         * @return array
-         */
-        static function getopt() {
-
-                if ( func_num_args() == 1 ) {
-                        $flag = $flag_array = $GLOBALS['argv'];
-                        $short_option = func_get_arg ( 0 );
-                        $long_option = array ();
-                } elseif ( func_num_args() == 2 ) {
-                        if ( is_array ( func_get_arg ( 1 ) ) ) {
-                        $flag = $GLOBALS['argv'];
-                        $short_option = func_get_arg ( 0 );
-                        $long_option = func_get_arg ( 1 );
-                        } else {
-                        $flag = func_get_arg ( 0 );
-                        $short_option = func_get_arg ( 1 );
-                        $long_option = array ();
-                        }
-                } elseif ( func_num_args() == 3 ) {
-                        $flag = func_get_arg ( 0 );
-                        $short_option = func_get_arg ( 1 );
-                        $long_option = func_get_arg ( 2 );
-                } else {
-                        exit ( "wrong options\n" );
-                }
-
-                $short_option = trim($short_option);
-                $short_no_value = array();
-                $short_required_value = array();
-                $short_optional_value = array();
-                $long_no_value = array();
-                $long_required_value = array();
-                $long_optional_value = array();
-                $options = array();
-
-                for ( $i = 0; $i < strlen ( $short_option ); ) {
-                        if ( $short_option[$i] != ':' ) {
-                                if ( $i == strlen ( $short_option ) - 1 ) {
-                                        $short_no_value[] = $short_option[$i];
-                                        break;
-                                } elseif ( $short_option[$i+1] != ':' ) {
-                                        $short_no_value[] = $short_option[$i];
-                                        $i++;
-                                        continue;
-                                } elseif ( $short_option[$i+1] == ':' && $short_option[$i+2] != ':' ) {
-                                        $short_required_value[] = $short_option[$i];
-                                        $i += 2;
-                                        continue;
-                                } elseif ( $short_option[$i+1] == ':' && $short_option[$i+2] == ':' ) {
-                                        $short_optional_value[] = $short_option[$i];
-                                        $i += 3;
-                                        continue;
-                                }
-                        } else {
-                                continue;
-                        }
-                }
-
-                foreach ( $long_option as $a ) {
-                        if ( substr( $a, -2 ) == '::' ) {
-                                $long_optional_value[] = substr($a, 0, -2);
-                        } elseif ( substr($a, -1) == ':' ) {
-                                $long_required_value[] = substr($a, 0, -1);
-                        } else {
-                                $long_no_value[] = $a;
-                        }
-                }
-
-                if ( is_array ( $flag ) ) {
-                        $flag_array = $flag;
-                } else {
-                        $flag = "- $flag";
-                        $flag_array = self::_split_para($flag);
-                }
-
-                for ( $i = 0; $i < count($flag_array); ) {
-
-                        if ( !$flag_array[$i] || ( '-' == $flag_array[$i] ) ) {
-                                $i++;
-                                continue;
-                        } elseif ( '-' != $flag_array[$i][0] ) {
-                                $i++;
-                                continue;
-                        }
-
-                        if ( substr($flag_array[$i], 0, 2) == '--' ) {
-                                if (strpos($flag_array[$i], '=') != false) {
-                                        list($key, $value) = explode('=', substr($flag_array[$i], 2), 2);
-                                        if ( in_array($key, $long_required_value ) || in_array($key, $long_optional_value ) )
-                                                $options[$key][] = $value;
-                                        $i++;
-                                        continue;
-                                } elseif (strpos($flag_array[$i], '=') == false) {
-                                        $key = substr($flag_array[$i], 2);
-                                        if ( in_array(substr( $flag_array[$i], 2 ), $long_required_value ) ) {
-                                                $options[$key][] = $flag_array[$i+1];
-                                                $i++;
-                                        } elseif ( in_array(substr( $flag_array[$i], 2 ), $long_optional_value ) ) {
-                                                if ( $flag_array[$i+1] != '' && $flag_array[$i+1][0] != '-' ) {
-                                                        $options[$key][] = $flag_array[$i+1];
-                                                        $i++;
-                                                } else {
-                                                        $options[$key][] = FALSE;
-                                                }
-                                        } elseif ( in_array(substr( $flag_array[$i], 2 ), $long_no_value ) ) {
-                                                $options[$key][] = FALSE;
-                                        }
-                                        $i++;
-                                        continue;
-                                }
-                        } elseif ( $flag_array[$i][0] == '-' && $flag_array[$i][1] != '-' ) {
-                                for ( $j=1; $j < strlen($flag_array[$i]); $j++ ) {
-                                        if ( in_array($flag_array[$i][$j], $short_required_value ) || in_array($flag_array[$i][$j], $short_optional_value )) {
-                                                if ( $j == strlen($flag_array[$i]) - 1 ) {
-                                                        if ( in_array($flag_array[$i][$j], $short_required_value ) ) {
-                                                                if (isset($flag_array[$i+1]))
-                                                                        $options[$flag_array[$i][$j]][] = $flag_array[$i+1];
-                                                                $i++;
-                                                        } elseif ( in_array($flag_array[$i][$j], $short_optional_value ) && $flag_array[$i+1] != '' && $flag_array[$i+1][0] != '-' ) {
-                                                                $options[$flag_array[$i][$j]][] = $flag_array[$i+1];
-                                                                $i++;
-                                                        } else {
-                                                                $options[$flag_array[$i][$j]][] = FALSE;
-                                                        }
-                                                } else {
-                                                        $options[$flag_array[$i][$j]][] = substr ( $flag_array[$i], $j + 1 );
-                                                }
-                                                $plus_i = 0;
-                                                $i++;
-                                                break;
-                                        } elseif ( in_array($flag_array[$i][$j], $short_no_value ) ) {
-                                                $options[$flag_array[$i][$j]][] = FALSE;
-                                                $plus_i = 1;
-                                                continue;
-                                        } else {
-                                                $plus_i = 1;
-                                                break;
-                                        }
-                                }
-                                $i += $plus_i;
-                                continue;
-                        } // if
-                        $i++;
-                } // for
-
-                // reduce options array depth if possible
-                foreach ( $options as $key => $value ) {
-                        if ( count($value) == 1 )
-                                $options[$key] = $value[0];
-                }
-
-                return $options;
-
-        }
-
-        /**
-         * split parameters
-         *
-         * static helper function
-         *
-         * @version 1.0
-         * @date 2008/08/19
-         * @see http://www.ntu.beautifulworldco.com/weblog/?p=526
-         *
-         * This function is to parse parameters and split them into smaller pieces.
-         * preg_split() does similar thing but in our function, besides "space", we
-         * also take the three symbols " (double quote), '(single quote),
-         * and \ (backslash) into consideration because things in a pair of " or '
-         * should be grouped together.
-         *
-         * As an example, this parameter list
-         *
-         * -f "test 2" -ab --required "t\"est 1" --optional="te'st 3" --option -v 'test 4'
-         *
-         * will be splited into
-         *
-         * -f; test 2; -ab; --required; t"est 1; --optional=te'st 3; --option; -v; test 4
-         *
-         * see the code below:
-         *
-         * <code>
-         *        $pattern = "-f \"test 2\" -ab --required \"t\\\"est 1\" --optional=\"te'st 3\" --option -v 'test 4'";
-         *        $result = getoptParser::split_para($pattern);
-         *        echo "ORIGINAL PATTERN: $pattern\n\n";
-         *        var_dump($result);
-         * </code>
-         *
-         * @param string $pattern
-         * @return array
-         */
-        public static function split_para($pattern) {
-                $begin = 0;
-                $backslash = 0;
-                $quote = '';
-                $quote_mark = array();
-                $result = array();
-                $pattern        = trim($pattern);
-                $cand1 = '';
-
-                for ( $end = 0; $end < strlen($pattern); ) {
-                        if ( !in_array($pattern[$end], array(' ', '"', "'", "\\")) ) {
-                                $backslash = 0;
-                                $end++;
-                                continue;
-                        }
-                        if ( $pattern[$end] == "\\" ) {
-                                $backslash++;
-                                $end++;
-                                continue;
-                        } elseif ( $pattern[$end] == '"' ) {
-                                if ( $backslash % 2 == 1 || $quote == "'" ) {
-                                        $backslash = 0;
-                                        $end++;
-                                        continue;
-                                }
-                                if ( $quote == '' ) {
-                                        $quote_mark[] = $end - $begin;
-                                        $quote = '"';
-                                } elseif ( $quote == '"' ) {
-                                        $quote_mark[] = $end - $begin;
-                                        $quote = '';
-                                }
-
-                                $backslash = 0;
-                                $end++;
-                                continue;
-                        } elseif ( $pattern[$end] == "'" ) {
-                                if ( $backslash % 2 == 1 || $quote == '"' ) {
-                                        $backslash = 0;
-                                        $end++;
-                                        continue;
-                                }
-                                if ( $quote == '' ) {
-                                        $quote_mark[] = $end - $begin;
-                                        $quote = "'";
-                                } elseif ( $quote == "'" ) {
-                                        $quote_mark[] = $end - $begin;
-                                        $quote = '';
-                                }
-
-                                $backslash = 0;
-                                $end++;
-                                continue;
-                        } elseif ( $pattern[$end] == ' ' ) {
-                                if ( $quote != '' ) {
-                                        $backslash = 0;
-                                        $end++;
-                                        continue;
-                                } else {
-                                        $backslash = 0;
-                                        $cand = substr($pattern, $begin, $end-$begin);
-                                        for ( $j = 0; $j < strlen($cand); $j++ ) {
-                                                if ( in_array($j, $quote_mark) )
-                                                        continue;
-
-                                        $cand1 .= $cand[$j];
-                                }
-                                if ( $cand1 ) {
-                                        // commented and replaced:
-                                        // eval( "\$cand1 = \"$cand1\";" );
-                                        $result[] = (string) $cand1;
-                                }
-                                $quote_mark = array();
-                                $cand1 = '';
-                                $begin =++$end;
-                                continue;
-                                }
-                        }
-                }
-
-                $cand = substr($pattern, $begin, $end-$begin);
-                for ( $j = 0; $j < strlen($cand); $j++ ) {
-                        if ( in_array($j, $quote_mark ) )
-                                continue;
-                        $cand1 .= $cand[$j];
-                }
-
-                // commented and replaced:
-                // eval( "\$cand1 = \"$cand1\";" );
-                $cand1 = (string) $cand1;
-
-                if ( $cand1 )
-                        $result[] = $cand1;
-
-                return $result;
-        }
-}
-?>
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkphpunitxml"></a>
<div class="modfile"><h4>Modified: trunk/phpunit.xml (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/phpunit.xml        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/phpunit.xml        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -6,9 +6,9 @@
</span><span class="cx"> <testsuites>
</span><span class="cx"> <!-- Default test suite to run all tests -->
</span><span class="cx"> <testsuite>
</span><del>- <directory suffix=".php">wp-testcase</directory>
- <file phpVersion="5.3.0" phpVersionOperator=">=">wp-testcase/test_actions_closures.php</file>
- <exclude>wp-testcase/test_query_results.php</exclude>
</del><ins>+ <directory suffix=".php">tests</directory>
+ <file phpVersion="5.3.0">tests/test_actions_closures.php</file>
+ <exclude>tests/test_query_results.php</exclude>
</ins><span class="cx"> </testsuite>
</span><span class="cx"> </testsuites>
</span><span class="cx"> </phpunit>
</span></span></pre></div>
<a id="trunkteststest_httpphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/test_http.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_http.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/tests/test_http.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> * @group http
</span><span class="cx"> */
</span><span class="cx"> abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
</span><del>-        // You can use your own version of wp-testdata/WPHTTP-testcase-redirection-script.php here.
</del><ins>+        // You can use your own version of data/WPHTTP-testcase-redirection-script.php here.
</ins><span class="cx">         var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
</span><span class="cx">
</span><span class="cx">         function setUp() {
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_file_stream() {
</span><del>-                $url = 'http://unit-tests.svn.wordpress.org/trunk/wp-testdata/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
</del><ins>+                $url = 'http://unit-tests.svn.wordpress.org/trunk/data/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
</ins><span class="cx">                 $size = 87348;
</span><span class="cx">                 $res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkteststest_import_wpphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/test_import_wp.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_import_wp.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/tests/test_import_wp.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,9 +1,5 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-#include_once(DIR_TESTROOT.'/wp-testlib/wp-profiler.php');
-
-// need to include the importer as an external, so path may need to change...
-
</del><span class="cx"> abstract class WP_Import_UnitTestCase extends WP_UnitTestCase {
</span><span class="cx">         /**
</span><span class="cx">          * Import a WXR file.
</span></span></pre></div>
<a id="trunkteststest_includes_functionsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/test_includes_functions.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_includes_functions.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/tests/test_includes_functions.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">
</span><span class="cx">         function test_wp_unique_filename() {
</span><span class="cx">                 /* this test requires:
</span><del>-                 - that you have dir + file 'wp-testdata/images/test-image.png',
</del><ins>+                 - that you have dir + file 'data/images/test-image.png',
</ins><span class="cx">                  - and that this dir is writeable
</span><span class="cx">                  - there is an image 'test-image.png' that will be used to test unique filenames
</span><span class="cx">
</span></span></pre></div>
<a id="trunkteststest_post_outputphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/test_post_output.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_post_output.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/tests/test_post_output.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx">         function test_the_content() {
</span><span class="cx">                 // permalink page
</span><span class="cx">                 $link = '/2008/04/01/simple-gallery-test/';
</span><del>-                $this->http('/2008/04/01/simple-gallery-test/');
</del><ins>+                $this->go_to('/2008/04/01/simple-gallery-test/');
</ins><span class="cx">                 the_post();
</span><span class="cx">                 // filtered output
</span><span class="cx">                 $out = get_echo('the_content');
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx">                 wp_update_post($post);
</span><span class="cx">
</span><span class="cx">                 // permalink page
</span><del>-                $this->http('/2008/04/01/simple-gallery-test/');
</del><ins>+                $this->go_to('/2008/04/01/simple-gallery-test/');
</ins><span class="cx">                 the_post();
</span><span class="cx">                 // filtered output
</span><span class="cx">                 $out = get_echo('the_content');
</span></span></pre></div>
<a id="trunkwpconfigsamplephp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-config-sample.php (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-config-sample.php        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/wp-config-sample.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-<?php
-
-/* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
-define( 'ABSPATH', dirname( __FILE__ ) . '/wordpress/' );
-
-// Test with multisite enabled: (previously -m)
-// define( 'WP_TESTS_MULTISITE', true );
-
-// Force known bugs: (previously -f)
-// define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
-
-// Test with WordPress debug mode on (previously -d)
-// define( 'WP_DEBUG', true );
-
-// ** MySQL settings ** //
-
-// This configuration file will be used by the copy of WordPress being tested.
-// wordpress/wp-config.php will be ignored.
-
-// WARNING WARNING WARNING!
-// wp-test will DROP ALL TABLES in the database named below.
-// DO NOT use a production database or one that is shared with something else.
-
-define( 'DB_NAME', 'putyourdbnamehere' ); // The name of the database
-define( 'DB_USER', 'usernamehere' ); // Your MySQL username
-define( 'DB_PASSWORD', 'yourpasswordhere' ); // ...and password
-define( 'DB_HOST', 'localhost' ); // 99% chance you won't need to change this value
-define( 'DB_CHARSET', 'utf8' );
-define( 'DB_COLLATE', '' );
-
-// You can have multiple installations in one database if you give each a unique prefix
-$table_prefix = 'wp_'; // Only numbers, letters, and underscores please!
-
-// Change this to localize WordPress. A corresponding MO file for the
-// chosen language must be installed to wp-content/languages.
-// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
-// to enable German language support.
-define ( 'WPLANG', '' );
-
-define( 'WP_TESTS_DOMAIN', 'example.org' );
-define( 'WP_TESTS_EMAIL', 'admin@example.org' );
-define( 'WP_TESTS_TITLE', 'Test Blog' );
-
-$table_prefix = 'wp_';
-
-define( 'WP_PHP_BINARY', 'php' );
</del></span></pre></div>
<a id="trunkwptestsconfigsamplephpfromrev872trunkwpconfigsamplephp"></a>
<div class="copfile"><h4>Copied: trunk/wp-tests-config-sample.php (from rev 872, trunk/wp-config-sample.php) (0 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-tests-config-sample.php         (rev 0)
+++ trunk/wp-tests-config-sample.php        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+<?php
+
+/* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
+define( 'ABSPATH', dirname( __FILE__ ) . '/wordpress/' );
+
+// Test with multisite enabled: (previously -m)
+// define( 'WP_TESTS_MULTISITE', true );
+
+// Force known bugs: (previously -f)
+// define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
+
+// Test with WordPress debug mode on (previously -d)
+// define( 'WP_DEBUG', true );
+
+// ** MySQL settings ** //
+
+// This configuration file will be used by the copy of WordPress being tested.
+// wordpress/wp-config.php will be ignored.
+
+// WARNING WARNING WARNING!
+// wp-test will DROP ALL TABLES in the database named below.
+// DO NOT use a production database or one that is shared with something else.
+
+define( 'DB_NAME', 'putyourdbnamehere' ); // The name of the database
+define( 'DB_USER', 'usernamehere' ); // Your MySQL username
+define( 'DB_PASSWORD', 'yourpasswordhere' ); // ...and password
+define( 'DB_HOST', 'localhost' ); // 99% chance you won't need to change this value
+define( 'DB_CHARSET', 'utf8' );
+define( 'DB_COLLATE', '' );
+
+// You can have multiple installations in one database if you give each a unique prefix
+$table_prefix = 'wp_'; // Only numbers, letters, and underscores please!
+
+// Change this to localize WordPress. A corresponding MO file for the
+// chosen language must be installed to wp-content/languages.
+// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
+// to enable German language support.
+define ( 'WPLANG', '' );
+
+define( 'WP_TESTS_DOMAIN', 'example.org' );
+define( 'WP_TESTS_EMAIL', 'admin@example.org' );
+define( 'WP_TESTS_TITLE', 'Test Blog' );
+
+$table_prefix = 'wp_';
+
+define( 'WP_PHP_BINARY', 'php' );
</ins></span></pre></div>
<a id="trunkwptestsh"></a>
<div class="delfile"><h4>Deleted: trunk/wptest.sh (874 => 875)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wptest.sh        2012-07-03 16:26:26 UTC (rev 874)
+++ trunk/wptest.sh        2012-07-03 17:24:03 UTC (rev 875)
</span><span class="lines">@@ -1,3 +0,0 @@
</span><del>-#!/bin/bash
-# Run the test runner passing all CLI args on
-php wp-test.php $@
</del></span></pre>
</div>
</div>
</body>
</html>