<!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>[29120] trunk/tests/phpunit: Wouldn't it be incredible if you could run Unit Tests without all of your uploads being indiscriminately blown away and your upload folder permissions being destroyed?</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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29120">29120</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-07-12 07:08:15 +0000 (Sat, 12 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Wouldn't it be incredible if you could run Unit Tests without all of your uploads being indiscriminately blown away and your upload folder permissions being destroyed?

The Future Is Now.

Fixes <a href="http://core.trac.wordpress.org/ticket/28847">#28847</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunitincludestestcasephp">trunk/tests/phpunit/includes/testcase.php</a></li>
<li><a href="#trunktestsphpunitincludesutilsphp">trunk/tests/phpunit/includes/utils.php</a></li>
<li><a href="#trunktestsphpunittestsajaxMediaEditphp">trunk/tests/phpunit/tests/ajax/MediaEdit.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsdeprecatedphp">trunk/tests/phpunit/tests/functions/deprecated.php</a></li>
<li><a href="#trunktestsphpunittestshttpbasephp">trunk/tests/phpunit/tests/http/base.php</a></li>
<li><a href="#trunktestsphpunittestsimagebasephp">trunk/tests/phpunit/tests/image/base.php</a></li>
<li><a href="#trunktestsphpunittestsimageeditor_gdphp">trunk/tests/phpunit/tests/image/editor_gd.php</a></li>
<li><a href="#trunktestsphpunittestsimageeditor_imagickphp">trunk/tests/phpunit/tests/image/editor_imagick.php</a></li>
<li><a href="#trunktestsphpunittestsimagefunctionsphp">trunk/tests/phpunit/tests/image/functions.php</a></li>
<li><a href="#trunktestsphpunittestsimageintermediate_sizephp">trunk/tests/phpunit/tests/image/intermediate_size.php</a></li>
<li><a href="#trunktestsphpunittestsimageresizephp">trunk/tests/phpunit/tests/image/resize.php</a></li>
<li><a href="#trunktestsphpunittestsimageresize_gdphp">trunk/tests/phpunit/tests/image/resize_gd.php</a></li>
<li><a href="#trunktestsphpunittestsimageresize_imagickphp">trunk/tests/phpunit/tests/image/resize_imagick.php</a></li>
<li><a href="#trunktestsphpunittestspostattachmentsphp">trunk/tests/phpunit/tests/post/attachments.php</a></li>
<li><a href="#trunktestsphpunittestsuploadphp">trunk/tests/phpunit/tests/upload.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitincludestestcasephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/includes/testcase.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/includes/testcase.php        2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/includes/testcase.php   2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -11,6 +11,8 @@
</span><span class="cx">  protected $expected_doing_it_wrong = array();
</span><span class="cx">  protected $caught_doing_it_wrong = array();
</span><span class="cx"> 
</span><ins>+       protected static $ignore_files;
+
</ins><span class="cx">   /**
</span><span class="cx">   * @var WP_UnitTest_Factory
</span><span class="cx">   */
</span><span class="lines">@@ -19,6 +21,10 @@
</span><span class="cx">  function setUp() {
</span><span class="cx">          set_time_limit(0);
</span><span class="cx"> 
</span><ins>+               if ( ! self::$ignore_files ) {
+                       self::$ignore_files = $this->scan_user_uploads();
+               }
+
</ins><span class="cx">           global $wpdb;
</span><span class="cx">          $wpdb->suppress_errors = false;
</span><span class="cx">          $wpdb->show_errors = true;
</span><span class="lines">@@ -325,4 +331,54 @@
</span><span class="cx">                  $message .= implode( $not_false, ', ' ) . ' should be false.';
</span><span class="cx">          $this->assertTrue( $passed, $message );
</span><span class="cx">  }
</span><del>-}
</del><ins>+
+       function unlink( $file ) {
+               $exists = is_file( $file );
+               if ( $exists && ! in_array( $file, self::$ignore_files ) ) {
+                       //error_log( $file );
+                       unlink( $file );
+               } elseif ( ! $exists ) {
+                       $this->fail( "Trying to delete a file that doesn't exist: $file" );
+               }
+       }
+
+       function rmdir( $path ) {
+               $files = $this->files_in_dir( $path );
+               foreach ( $files as $file ) {
+                       if ( ! in_array( $file, self::$ignore_files ) ) {
+                               $this->unlink( $file );
+                       }
+               }
+       }
+
+       function remove_added_uploads() {
+               // Remove all uploads.
+               $uploads = wp_upload_dir();
+               $this->rmdir( $uploads['basedir'] );
+       }
+
+       function files_in_dir( $dir ) {
+               $files = array();
+
+               $iterator = new RecursiveDirectoryIterator( $dir );
+               $objects = new RecursiveIteratorIterator( $iterator );
+               foreach ( $objects as $name => $object ) {
+                       if ( is_file( $name ) ) {
+                               $files[] = $name;
+                       }
+               }
+
+               return $files;
+       }
+
+       function scan_user_uploads() {
+               static $files = array();
+               if ( ! empty( $files ) ) {
+                       return $files;
+               }
+
+               $uploads = wp_upload_dir();
+               $files = $this->files_in_dir( $uploads['basedir'] );
+               return $files;
+       }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunitincludesutilsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/includes/utils.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/includes/utils.php   2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/includes/utils.php      2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -313,18 +313,6 @@
</span><span class="cx">  }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function _rmdir( $path ) {
-       if ( in_array(basename( $path ), array( '.', '..' ) ) ) {
-               return;
-       } elseif ( is_file( $path ) ) {
-               unlink( $path );
-       } elseif ( is_dir( $path ) ) {
-               foreach ( scandir( $path ) as $file )
-                       _rmdir( $path . '/' . $file );
-               rmdir( $path );
-       }
-}
-
</del><span class="cx"> /**
</span><span class="cx">  * Removes the post type and its taxonomy associations.
</span><span class="cx">  */
</span></span></pre></div>
<a id="trunktestsphpunittestsajaxMediaEditphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/ajax/MediaEdit.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/ajax/MediaEdit.php     2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/ajax/MediaEdit.php        2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -32,14 +32,10 @@
</span><span class="cx">   */
</span><span class="cx">  public function tearDown() {
</span><span class="cx">          // Cleanup
</span><del>-               foreach ($this->_ids as $id){
-                       wp_delete_attachment($id, true);
</del><ins>+                foreach ( $this->_ids as $id ) {
+                       wp_delete_attachment( $id, true );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><del>-               $uploads = wp_upload_dir();
-               foreach ( scandir( $uploads['basedir'] ) as $file )
-                       _rmdir( $uploads['basedir'] . '/' . $file );
-
</del><span class="cx">           parent::tearDown();
</span><span class="cx">  }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/functions/deprecated.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/functions/deprecated.php       2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/functions/deprecated.php  2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">          $img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
</span><span class="cx">          wp_save_image_file( $file, $img, 'image/jpeg', 1 );
</span><span class="cx">          imagedestroy( $img );
</span><del>-               @unlink($file);
</del><ins>+                unlink( $file );
</ins><span class="cx"> 
</span><span class="cx">          // Check if the arg was deprecated
</span><span class="cx">          $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx">          $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
</span><span class="cx">          wp_save_image_file( $file, $img, 'image/jpeg', 1 );
</span><span class="cx">          unset( $img );
</span><del>-               @unlink($file);
</del><ins>+                unlink( $file );
</ins><span class="cx"> 
</span><span class="cx">          // Check if the arg was deprecated
</span><span class="cx">          $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span></span></pre></div>
<a id="trunktestsphpunittestshttpbasephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/http/base.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/http/base.php  2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/http/base.php     2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -284,6 +284,6 @@
</span><span class="cx">          $res = wp_remote_get( 'https://wordpress.org/' );
</span><span class="cx">          $this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) );
</span><span class="cx">  }
</span><del>-       
-       
</del><ins>+
+
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsimagebasephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/base.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/base.php 2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/base.php    2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -9,6 +9,8 @@
</span><span class="cx">   * Set the image editor engine according to the unit test's specification
</span><span class="cx">   */
</span><span class="cx">  public function setUp() {
</span><ins>+               parent::setUp();
+
</ins><span class="cx">           if ( ! call_user_func( array( $this->editor_engine, 'test' ) ) ) {
</span><span class="cx">                  $this->markTestSkipped( sprintf('The image editor engine %s is not supported on this system', $this->editor_engine) );
</span><span class="cx">          }
</span><span class="lines">@@ -20,6 +22,8 @@
</span><span class="cx">   * Undo the image editor override
</span><span class="cx">   */
</span><span class="cx">  public function tearDown() {
</span><ins>+               parent::tearDown();
+
</ins><span class="cx">           remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -33,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="cx">   * Helper assertion for testing alpha on images
</span><del>-        * 
</del><ins>+         *
</ins><span class="cx">    * @param  string $image_path
</span><span class="cx">   * @param  array $point      array(x,y)
</span><span class="cx">   * @param  int $alpha
</span></span></pre></div>
<a id="trunktestsphpunittestsimageeditor_gdphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/editor_gd.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/editor_gd.php    2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/editor_gd.php       2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx">  * @group media
</span><span class="cx">  * @group wp-image-editor-gd
</span><span class="cx">  */
</span><ins>+require_once( dirname( __FILE__ ) . '/base.php' );
</ins><span class="cx"> 
</span><span class="cx"> class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
</span><span class="cx"> 
</span><span class="lines">@@ -18,14 +19,16 @@
</span><span class="cx">          parent::setUp();
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       public function shutDown() {
</del><ins>+        public function tearDown() {
</ins><span class="cx">           $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
</span><span class="cx"> 
</span><span class="cx">          foreach ( glob( $folder ) as $file ) {
</span><span class="cx">                  unlink( $file );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               parent::shutDown();
</del><ins>+                $this->remove_added_uploads();
+
+               parent::tearDown();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -467,6 +470,8 @@
</span><span class="cx">          $editor->save( $save_to_file );
</span><span class="cx"> 
</span><span class="cx">          $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><ins>+
+               unlink( $save_to_file );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -485,5 +490,7 @@
</span><span class="cx">          $editor->save( $save_to_file );
</span><span class="cx"> 
</span><span class="cx">          $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><ins>+
+               unlink( $save_to_file );
</ins><span class="cx">   }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsimageeditor_imagickphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/editor_imagick.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/editor_imagick.php       2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/editor_imagick.php  2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx">  * @group media
</span><span class="cx">  * @group wp-image-editor-imagick
</span><span class="cx">  */
</span><ins>+require_once( dirname( __FILE__ ) . '/base.php' );
</ins><span class="cx"> 
</span><span class="cx"> class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
</span><span class="cx"> 
</span><span class="lines">@@ -18,14 +19,16 @@
</span><span class="cx">          parent::setUp();
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       public function shutDown() {
</del><ins>+        public function tearDown() {
</ins><span class="cx">           $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
</span><span class="cx"> 
</span><span class="cx">          foreach ( glob( $folder ) as $file ) {
</span><span class="cx">                  unlink( $file );
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               parent::shutDown();
</del><ins>+                $this->remove_added_uploads();
+
+               parent::tearDown();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -463,10 +466,12 @@
</span><span class="cx">          $editor->load();
</span><span class="cx">          $editor->resize( 5, 5 );
</span><span class="cx">          $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
</span><del>-               
</del><ins>+
</ins><span class="cx">           $editor->save( $save_to_file );
</span><span class="cx"> 
</span><span class="cx">          $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><ins>+
+               unlink( $save_to_file );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -485,5 +490,7 @@
</span><span class="cx">          $editor->save( $save_to_file );
</span><span class="cx"> 
</span><span class="cx">          $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><ins>+
+               unlink( $save_to_file );
</ins><span class="cx">   }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsimagefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/functions.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/functions.php    2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/functions.php       2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">          // these are image files but aren't suitable for web pages because of compatibility or size issues
</span><span class="cx">          $files = array(
</span><span class="cx">                  // 'test-image-cmyk.jpg', Allowed in r9727
</span><del>-                       // 'test-image.bmp', Allowed in r28589 
</del><ins>+                        // 'test-image.bmp', Allowed in r28589
</ins><span class="cx">                   // 'test-image-grayscale.jpg', Allowed in r9727
</span><span class="cx">                  'test-image.pct',
</span><span class="cx">                  'test-image.tga',
</span><span class="lines">@@ -144,8 +144,8 @@
</span><span class="cx">                          $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><span class="cx"> 
</span><span class="cx">                          // Clean up
</span><del>-                               @unlink( $file );
-                               @unlink( $ret['path'] );
</del><ins>+                                unlink( $file );
+                               unlink( $ret['path'] );
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  // Clean up
</span><span class="lines">@@ -185,8 +185,8 @@
</span><span class="cx">                  $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><span class="cx"> 
</span><span class="cx">                  // Clean up
</span><del>-                       @unlink( $file );
-                       @unlink( $ret['path'] );
</del><ins>+                        unlink( $file );
+                       unlink( $ret['path'] );
</ins><span class="cx">                   unset( $img );
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="lines">@@ -231,8 +231,7 @@
</span><span class="cx">                          $this->assertNotEmpty( $ret );
</span><span class="cx">                          $this->assertNotInstanceOf( 'WP_Error', $ret );
</span><span class="cx">                          $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><del>-                               @unlink( $file );
-                               @unlink( $ret['path'] );
</del><ins>+                                unlink( $ret['path'] );
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  // Clean up
</span></span></pre></div>
<a id="trunktestsphpunittestsimageintermediate_sizephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/intermediate_size.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/intermediate_size.php    2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/intermediate_size.php       2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -1,11 +1,15 @@
</span><span class="cx"> <?php
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * @group image
</span><span class="cx">  * @group media
</span><span class="cx">  * @group upload
</span><span class="cx">  */
</span><span class="cx"> class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
</span><ins>+       function tearDown() {
+               $this->remove_added_uploads();
+               parent::tearDown();
+       }
+
</ins><span class="cx">   function test_make_intermediate_size_no_size() {
</span><span class="cx">          $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsimageresizephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/resize.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/resize.php       2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/resize.php  2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -4,7 +4,10 @@
</span><span class="cx">  * @group image
</span><span class="cx">  * @group media
</span><span class="cx">  * @group upload
</span><ins>+ * @group resize
</ins><span class="cx">  */
</span><ins>+require_once( dirname( __FILE__ ) . '/base.php' );
+
</ins><span class="cx"> abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase {
</span><span class="cx"> 
</span><span class="cx">  function test_resize_jpg() {
</span><span class="lines">@@ -108,7 +111,7 @@
</span><span class="cx">          $this->assertEquals( 100, $h );
</span><span class="cx">          $this->assertEquals( IMAGETYPE_JPEG, $type );
</span><span class="cx"> 
</span><del>-               unlink($image);
</del><ins>+                unlink( $image );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function test_resize_thumb_50x150_crop() {
</span></span></pre></div>
<a id="trunktestsphpunittestsimageresize_gdphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/resize_gd.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/resize_gd.php    2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/resize_gd.php       2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -4,7 +4,10 @@
</span><span class="cx">  * @group image
</span><span class="cx">  * @group media
</span><span class="cx">  * @group upload
</span><ins>+ * @group resize
</ins><span class="cx">  */
</span><ins>+require_once( dirname( __FILE__ ) . '/resize.php' );
+
</ins><span class="cx"> class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -12,4 +15,11 @@
</span><span class="cx">   * @var string
</span><span class="cx">   */
</span><span class="cx">  public $editor_engine = 'WP_Image_Editor_GD';
</span><ins>+
+       public function setUp() {
+               require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+               require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
+
+               parent::setUp();
+       }
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunittestsimageresize_imagickphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/image/resize_imagick.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/image/resize_imagick.php       2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/image/resize_imagick.php  2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -4,7 +4,10 @@
</span><span class="cx">  * @group image
</span><span class="cx">  * @group media
</span><span class="cx">  * @group upload
</span><ins>+ * @group resize
</ins><span class="cx">  */
</span><ins>+require_once( dirname( __FILE__ ) . '/resize.php' );
+
</ins><span class="cx"> class Test_Image_Resize_Imagick extends WP_Tests_Image_Resize_UnitTestCase {
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -12,4 +15,11 @@
</span><span class="cx">   * @var string
</span><span class="cx">   */
</span><span class="cx">  public $editor_engine = 'WP_Image_Editor_Imagick';
</span><ins>+
+       public function setUp() {
+               require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+               require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' );
+
+               parent::setUp();
+       }
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsphpunittestspostattachmentsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/post/attachments.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/post/attachments.php   2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/post/attachments.php      2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -9,10 +9,7 @@
</span><span class="cx"> 
</span><span class="cx">  function tearDown() {
</span><span class="cx">          // Remove all uploads.
</span><del>-               $uploads = wp_upload_dir();
-               foreach ( scandir( $uploads['basedir'] ) as $file )
-                       _rmdir( $uploads['basedir'] . '/' . $file );
-
</del><ins>+                $this->remove_added_uploads();
</ins><span class="cx">           parent::tearDown();
</span><span class="cx">  }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/upload.php (29119 => 29120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/upload.php     2014-07-12 03:53:34 UTC (rev 29119)
+++ trunk/tests/phpunit/tests/upload.php        2014-07-12 07:08:15 UTC (rev 29120)
</span><span class="lines">@@ -22,13 +22,9 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  function tearDown() {
</span><ins>+               $this->remove_added_uploads();
+
</ins><span class="cx">           parent::tearDown();
</span><del>-
-               // Remove year/month folders created by wp_upload_dir().
-               $uploads = wp_upload_dir();
-               foreach ( scandir( $uploads['basedir'] ) as $file )
-                       _rmdir( $uploads['basedir'] . '/' . $file );
-               _rmdir( ABSPATH . 'foo/' );
</del><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  function test_upload_dir_default() {
</span></span></pre>
</div>
</div>

</body>
</html>