<!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>[35186] trunk/tests/phpunit: Unit Tests: implement `setUpBeforeClass()` and `tearDownAfterClass()` on `WP_UnitTestCase`.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/35186">35186</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/35186","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>wonderboymusic</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-10-15 04:43:37 +0000 (Thu, 15 Oct 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Unit Tests: implement `setUpBeforeClass()` and `tearDownAfterClass()` on `WP_UnitTestCase`. Use late static binding (plus a gross fallback for PHP 5.2) to check if `wpSetUpBeforeClass()` or `wpTearDownAfterClass()` exist on the called class, and then call it and pass a static `WP_UnitTest_Factory` instance via Dependency Injection, if it exists.
This makes it way easier to add fixtures, and tear them down, without needing to instantiate `WP_UnitTest_Factory` in every class - removes the need to call `commit_transaction()` in each individual class.
See <a href="https://core.trac.wordpress.org/ticket/30017">#30017</a>, <a href="https://core.trac.wordpress.org/ticket/33968">#33968</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunitincludestestcasephp">trunk/tests/phpunit/includes/testcase.php</a></li>
<li><a href="#trunktestsphpunittestsadminincludesListTablephp">trunk/tests/phpunit/tests/admin/includesListTable.php</a></li>
<li><a href="#trunktestsphpunittestsadminbarphp">trunk/tests/phpunit/tests/adminbar.php</a></li>
<li><a href="#trunktestsphpunittestsauthphp">trunk/tests/phpunit/tests/auth.php</a></li>
<li><a href="#trunktestsphpunittestscommentphp">trunk/tests/phpunit/tests/comment.php</a></li>
<li><a href="#trunktestsphpunittestsdbcharsetphp">trunk/tests/phpunit/tests/db/charset.php</a></li>
<li><a href="#trunktestsphpunittestsfeedrss2php">trunk/tests/phpunit/tests/feed/rss2.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsgetArchivesphp">trunk/tests/phpunit/tests/functions/getArchives.php</a></li>
<li><a href="#trunktestsphpunittestsmediaphp">trunk/tests/phpunit/tests/media.php</a></li>
<li><a href="#trunktestsphpunittestspostphp">trunk/tests/phpunit/tests/post.php</a></li>
<li><a href="#trunktestsphpunittestsquerydatephp">trunk/tests/phpunit/tests/query/date.php</a></li>
<li><a href="#trunktestsphpunittestsquerypostStatusphp">trunk/tests/phpunit/tests/query/postStatus.php</a></li>
<li><a href="#trunktestsphpunittestsqueryresultsphp">trunk/tests/phpunit/tests/query/results.php</a></li>
<li><a href="#trunktestsphpunittestsquerystickiesphp">trunk/tests/phpunit/tests/query/stickies.php</a></li>
<li><a href="#trunktestsphpunitteststermphp">trunk/tests/phpunit/tests/term.php</a></li>
<li><a href="#trunktestsphpunittestsusercountUserPostsphp">trunk/tests/phpunit/tests/user/countUserPosts.php</a></li>
<li><a href="#trunktestsphpunittestsuserlistAuthorsphp">trunk/tests/phpunit/tests/user/listAuthors.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitincludestestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/testcase.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/includes/testcase.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,6 +19,53 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $factory;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static $static_factory;
+
+ public static function get_called_class() {
+ if ( function_exists( 'get_called_class' ) ) {
+ return get_called_class();
+ }
+
+ // PHP 5.2 only
+ $backtrace = debug_backtrace();
+ // [0] WP_UnitTestCase::get_called_class()
+ // [1] WP_UnitTestCase::setUpBeforeClass()
+ if ( 'call_user_func' === $backtrace[2]['function'] ) {
+ return $backtrace[2]['args'][0][0];
+ }
+ return $backtrace[2]['class'];
+ }
+
+ public static function setUpBeforeClass() {
+ parent::setUpBeforeClass();
+
+ $c = self::get_called_class();
+ if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) {
+ return;
+ }
+
+ if ( ! self::$static_factory ) {
+ self::$static_factory = new WP_UnitTest_Factory();
+ }
+
+ call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::$static_factory );
+
+ self::commit_transaction();
+ }
+
+ public static function tearDownAfterClass() {
+ parent::tearDownAfterClass();
+
+ $c = self::get_called_class();
+ if ( ! method_exists( $c, 'wpTearDownAfterClass' ) ) {
+ return;
+ }
+
+ call_user_func( array( $c, 'wpTearDownAfterClass' ) );
+
+ self::commit_transaction();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px"> set_time_limit(0);
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsadminincludesListTablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/admin/includesListTable.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/admin/includesListTable.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/admin/includesListTable.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,9 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->table = _get_list_table( 'WP_Posts_List_Table' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // note that our top/children/grandchildren arrays are 1-indexed
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // create top level pages
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,16 +62,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunktestsphpunittestsadminbarphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/adminbar.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/adminbar.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/adminbar.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,21 +7,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_AdminBar extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static function setUpBeforeClass() {
- WP_UnitTestCase::setUpBeforeClass();
- require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function setUpBeforeClass() {
+ require_once( ABSPATH . WPINC . '/class-wp-admin-bar.php' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function setUp() {
- parent::setUp();
- $this->current_user = get_current_user_id();
- }
-
- function tearDown() {
- wp_set_current_user( $this->current_user );
- parent::tearDown();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 21117
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunktestsphpunittestsauthphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/auth.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/auth.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/auth.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,11 +15,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $nonce_failure_hook = 'wp_verify_nonce_failed';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static function setUpBeforeClass() {
- parent::setUpBeforeClass();
-
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$_user = $factory->user->create_and_get( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_login' => 'password-tests'
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,20 +24,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( ABSPATH . WPINC . '/class-phpass.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$wp_hasher = new PasswordHash( 8, true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
- parent::tearDownAfterClass();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( self::$user_id );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_user( self::$user_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestscommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/comment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/comment.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/comment.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,22 +7,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $user_id;
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $post_id;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- parent::setUpBeforeClass();
-
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$user_id = $factory->user->create();
</span><span class="cx" style="display: block; padding: 0 10px"> self::$post_id = $factory->post->create( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_author' => self::$user_id
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
- parent::tearDownAfterClass();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( self::$post_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,8 +22,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_user( self::$user_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_update_comment() {
</span></span></pre></div>
<a id="trunktestsphpunittestsdbcharsetphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/db/charset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/db/charset.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/db/charset.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-require_once dirname( dirname( __FILE__ ) ) . '/db.php';
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Test WPDB methods
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,6 +15,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $_wpdb;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function setUpBeforeClass() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ require_once( dirname( dirname( __FILE__ ) ) . '/db.php' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$_wpdb = new wpdb_exposed_methods_for_testing();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsfeedrss2php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/feed/rss2.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/feed/rss2.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/feed/rss2.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,18 +12,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> static $user;
</span><span class="cx" style="display: block; padding: 0 10px"> static $posts;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$user = $factory->user->create();
</span><span class="cx" style="display: block; padding: 0 10px"> self::$posts = $factory->post->create_many( 5, array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_author' => self::$user,
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( self::$user );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,8 +29,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$posts as $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsgetArchivesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/functions/getArchives.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/getArchives.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/functions/getArchives.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,19 +18,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->year_url = get_year_link( date( 'Y' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids = $factory->post->create_many( 8, array( 'post_type' => 'post', 'post_author' => '1' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_get_archives_default() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,12 +47,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $link4 = get_permalink( $ids[3] );
</span><span class="cx" style="display: block; padding: 0 10px"> $link5 = get_permalink( $ids[4] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $title1 = get_post( $ids[0] )->post_title;
+ $title2 = get_post( $ids[1] )->post_title;
+ $title3 = get_post( $ids[2] )->post_title;
+ $title4 = get_post( $ids[3] )->post_title;
+ $title5 = get_post( $ids[4] )->post_title;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $expected['limit'] = <<<EOF
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<li><a href='$link1'>Post title 8</a></li>
- <li><a href='$link2'>Post title 7</a></li>
- <li><a href='$link3'>Post title 6</a></li>
- <li><a href='$link4'>Post title 5</a></li>
- <li><a href='$link5'>Post title 4</a></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<li><a href='$link1'>$title1</a></li>
+ <li><a href='$link2'>$title2</a></li>
+ <li><a href='$link3'>$title3</a></li>
+ <li><a href='$link4'>$title4</a></li>
+ <li><a href='$link5'>$title5</a></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> EOF;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/media.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,23 +7,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Media extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $large_id;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- parent::setUpBeforeClass();
-
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $filename = DIR_TESTDATA . '/images/test-image-large.png';
</span><span class="cx" style="display: block; padding: 0 10px"> self::$large_id = $factory->attachment->create_upload_object( $filename );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
- parent::tearDownAfterClass();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_delete_attachment( self::$large_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestspostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/post.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,11 +9,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $editor_id;
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $grammarian_id;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- parent::setUpBeforeClass();
-
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$editor_id = $factory->user->create( array( 'role' => 'editor' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_role( 'grammarian', 'Grammarian', array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,13 +20,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> self::$grammarian_id = $factory->user->create( array( 'role' => 'grammarian' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
- parent::tearDownAfterClass();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $ids = array( self::$editor_id, self::$grammarian_id );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $ids as $id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,8 +31,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_user( $id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestsquerydatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/date.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/date.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/query/date.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12,7 +12,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> static $post_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Be careful modifying this. Tests are coded to expect this exact sample data.
</span><span class="cx" style="display: block; padding: 0 10px"> $post_dates = array(
</span><span class="cx" style="display: block; padding: 0 10px"> '1972-05-24 14:53:45',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,21 +40,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '2025-05-20 10:13:01',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $factory = new WP_UnitTest_Factory;
-
</del><span class="cx" style="display: block; padding: 0 10px"> foreach ( $post_dates as $post_date ) {
</span><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids[] = $factory->post->create( array( 'post_date' => $post_date ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestsquerypostStatusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/postStatus.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/postStatus.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/query/postStatus.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,25 +11,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public static $editor_privatefoo_post;
</span><span class="cx" style="display: block; padding: 0 10px"> public static $author_privatefoo_post;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $f = new WP_UnitTest_Factory;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
+ self::$editor_user = $factory->user->create( array( 'role' => 'editor' ) );
+ self::$author_user = $factory->user->create( array( 'role' => 'author' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::$editor_user = $f->user->create( array( 'role' => 'editor' ) );
- self::$author_user = $f->user->create( array( 'role' => 'author' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::$editor_private_post = $factory->post->create( array( 'post_author' => self::$editor_user, 'post_status' => 'private' ) );
+ self::$author_private_post = $factory->post->create( array( 'post_author' => self::$author_user, 'post_status' => 'private' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::$editor_private_post = $f->post->create( array( 'post_author' => self::$editor_user, 'post_status' => 'private' ) );
- self::$author_private_post = $f->post->create( array( 'post_author' => self::$author_user, 'post_status' => 'private' ) );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Custom status with private=true.
</span><span class="cx" style="display: block; padding: 0 10px"> register_post_status( 'privatefoo', array( 'private' => true ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::$editor_privatefoo_post = $f->post->create( array( 'post_author' => self::$editor_user, 'post_status' => 'privatefoo' ) );
- self::$author_privatefoo_post = $f->post->create( array( 'post_author' => self::$author_user, 'post_status' => 'privatefoo' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::$editor_privatefoo_post = $factory->post->create( array( 'post_author' => self::$editor_user, 'post_status' => 'privatefoo' ) );
+ self::$author_privatefoo_post = $factory->post->create( array( 'post_author' => self::$author_user, 'post_status' => 'privatefoo' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> _unregister_post_status( 'privatefoo' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( self::$editor_user );
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( self::$author_user );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,8 +38,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( self::$author_private_post, true );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( self::$editor_privatefoo_post, true );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( self::$author_privatefoo_post, true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_any_should_not_include_statuses_where_exclude_from_search_is_true() {
</span></span></pre></div>
<a id="trunktestsphpunittestsqueryresultsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/results.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/results.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/query/results.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,9 +22,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> static $child_three;
</span><span class="cx" style="display: block; padding: 0 10px"> static $child_four;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$cat_ids[] = $cat_a = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$cat_ids[] = $cat_b = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$cat_ids[] = $cat_c = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-c' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,11 +65,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids[] = self::$child_two = $factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => self::$parent_one, 'post_date' => '2007-01-01 00:00:02' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids[] = self::$child_three = $factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => self::$parent_two, 'post_date' => '2007-01-01 00:00:03' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids[] = self::$child_four = $factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => self::$parent_two, 'post_date' => '2007-01-01 00:00:04' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$cat_ids as $cat_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_term( $cat_id, 'category' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,8 +79,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestsquerystickiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/query/stickies.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/query/stickies.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/query/stickies.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,14 +8,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Query_Stickies extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px"> static $posts = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $f = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Set post times to get a reliable order.
</span><span class="cx" style="display: block; padding: 0 10px"> $now = time();
</span><span class="cx" style="display: block; padding: 0 10px"> for ( $i = 0; $i <= 22; $i++ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_date = date( 'Y-m-d H:i:s', $now - ( 10 * $i ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self::$posts[ $i ] = $f->post->create( array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self::$posts[ $i ] = $factory->post->create( array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'post_date' => $post_date,
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,16 +21,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> stick_post( self::$posts[2] );
</span><span class="cx" style="display: block; padding: 0 10px"> stick_post( self::$posts[14] );
</span><span class="cx" style="display: block; padding: 0 10px"> stick_post( self::$posts[8] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$posts as $p ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $p, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_stickies_should_be_ignored_when_is_home_is_false() {
</span></span></pre></div>
<a id="trunktestsphpunitteststermphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/term.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/term.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/term.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,22 +7,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $taxonomy = 'category';
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $post_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- parent::setUpBeforeClass();
-
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$post_ids = $factory->post->create_many( 5 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
- parent::tearDownAfterClass();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> array_map( 'wp_delete_post', self::$post_ids );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunktestsphpunittestsusercountUserPostsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/user/countUserPosts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/user/countUserPosts.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/user/countUserPosts.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,9 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> static $user_id;
</span><span class="cx" style="display: block; padding: 0 10px"> static $post_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$user_id = $factory->user->create( array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'role' => 'author',
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_login' => 'count_user_posts_user',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,11 +31,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_author' => 12345,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_type' => 'wptests_pt',
</span><span class="cx" style="display: block; padding: 0 10px"> ) ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( self::$user_id );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,8 +43,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span></span></pre></div>
<a id="trunktestsphpunittestsuserlistAuthorsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/user/listAuthors.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/user/listAuthors.php 2015-10-15 03:47:36 UTC (rev 35185)
+++ trunk/tests/phpunit/tests/user/listAuthors.php 2015-10-15 04:43:37 UTC (rev 35186)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,9 +23,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'style' => 'list',
</span><span class="cx" style="display: block; padding: 0 10px"> 'html' => true );
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function setUpBeforeClass() {
- $factory = new WP_UnitTest_Factory;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpSetUpBeforeClass( $factory ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> self::$users[] = $factory->user->create( array( 'user_login' => 'zack', 'display_name' => 'zack', 'role' => 'author', 'first_name' => 'zack', 'last_name' => 'moon' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$users[] = $factory->user->create( array( 'user_login' => 'bob', 'display_name' => 'bob', 'role' => 'author', 'first_name' => 'bob', 'last_name' => 'reno' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> self::$users[] = $factory->user->create( array( 'user_login' => 'paul', 'display_name' => 'paul', 'role' => 'author', 'first_name' => 'paul', 'last_name' => 'norris' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,11 +38,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> self::$user_urls[] = get_author_posts_url( $userid );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function tearDownAfterClass() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function wpTearDownAfterClass() {
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( array_merge( self::$users, array( self::$fred_id ) ) as $user_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wpmu_delete_user( $user_id );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,8 +52,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( self::$posts as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self::commit_transaction();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_list_authors_default() {
</span></span></pre>
</div>
</div>
</body>
</html>