WordPress.org

Make WordPress Core

Changeset 590 in tests


Ignore:
Timestamp:
03/26/12 22:24:14 (3 years ago)
Author:
kurtpayne
Message:

Fixing failed tests. See http://unit-test.trac.wordpress.org/ticket/29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_post.php

    r582 r590  
    493493        $contents = file_get_contents($filename); 
    494494 
    495         $upload = wp_upload_bits($filename, 'image/jpeg', $contents); 
     495        $upload = wp_upload_bits(basename($filename), 'image/jpeg', $contents); 
    496496        $this->assertTrue( empty($upload['error']) ); 
    497497 
     
    501501        $this->assertFalse( image_get_intermediate_size($id, 'thumbnail') ); 
    502502        $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 
    503  
    504         // the thumb url should point to the thumbnail intermediate 
    505         $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) ); 
    506  
    507         // image_downsize() should return the correct images and sizes 
    508         $this->assertFalse( image_downsize($id, 'thumbnail') ); 
    509503 
    510504        // medium and full size will both point to the original 
     
    527521        $contents = file_get_contents($filename); 
    528522 
    529         $upload = wp_upload_bits($filename, 'image/jpeg', $contents); 
     523        $upload = wp_upload_bits(basename($filename), 'image/jpeg', $contents); 
    530524        $this->assertTrue( empty($upload['error']) ); 
    531525 
     
    535529        $thumb = image_get_intermediate_size($id, 'thumbnail'); 
    536530        $this->assertEquals( 'a2-small-150x150.jpg', $thumb['file'] ); 
    537         $this->assertTrue( is_file($thumb['path']) ); 
     531 
     532        $uploads = wp_upload_dir(); 
     533        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) ); 
    538534 
    539535        $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 
     
    570566        $contents = file_get_contents($filename); 
    571567 
    572         $upload = wp_upload_bits($filename, 'image/jpeg', $contents); 
     568        $upload = wp_upload_bits(basename($filename), 'image/jpeg', $contents); 
    573569        $this->assertTrue( empty($upload['error']) ); 
    574570 
    575571        $id = $this->_make_attachment($upload); 
     572        $uploads = wp_upload_dir(); 
    576573 
    577574        // intermediate copies should exist: thumbnail and medium 
    578575        $thumb = image_get_intermediate_size($id, 'thumbnail'); 
    579         $this->assertEquals( '2007-06-17dsc_4173-150x150.jpg', $thumb['file'] ); 
    580         $this->assertTrue( is_file($thumb['path']) ); 
     576        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); 
     577        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) ); 
    581578 
    582579        $medium = image_get_intermediate_size($id, 'medium'); 
    583         $this->assertEquals( '2007-06-17dsc_4173-400x602.jpg', $medium['file'] ); 
    584         $this->assertTrue( is_file($medium['path']) ); 
     580        $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 
     581        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 
    585582 
    586583        // the thumb url should point to the thumbnail intermediate 
     
    589586        // image_downsize() should return the correct images and sizes 
    590587        $downsize = image_downsize($id, 'thumbnail'); 
    591         $this->assertEquals( '2007-06-17dsc_4173-150x150.jpg', basename($downsize[0]) ); 
     588        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($downsize[0]) ); 
    592589        $this->assertEquals( 150, $downsize[1] ); 
    593590        $this->assertEquals( 150, $downsize[2] ); 
    594591 
    595592        $downsize = image_downsize($id, 'medium'); 
    596         $this->assertEquals( '2007-06-17dsc_4173-400x602.jpg', basename($downsize[0]) ); 
     593        $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', basename($downsize[0]) ); 
    597594        $this->assertEquals( 400, $downsize[1] ); 
    598595        $this->assertEquals( 602, $downsize[2] ); 
    599596 
    600597        $downsize = image_downsize($id, 'full'); 
    601         $this->assertEquals( '2007-06-17dsc_4173.jpg', basename($downsize[0]) ); 
    602         $this->assertEquals( 500, $downsize[1] ); 
    603         $this->assertEquals( 752, $downsize[2] ); 
     598        $this->assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) ); 
     599        $this->assertEquals( 680, $downsize[1] ); 
     600        $this->assertEquals( 1024, $downsize[2] ); 
    604601    } 
    605602 
     
    614611        $contents = file_get_contents($filename); 
    615612 
    616         $upload = wp_upload_bits($filename, 'image/jpeg', $contents); 
     613        $upload = wp_upload_bits(basename($filename), 'image/jpeg', $contents); 
    617614        $this->assertTrue( empty($upload['error']) ); 
    618615 
    619616        $id = $this->_make_attachment($upload); 
     617        $uploads = wp_upload_dir(); 
    620618 
    621619        // check that the file and intermediates exist 
    622620        $thumb = image_get_intermediate_size($id, 'thumbnail'); 
    623         $this->assertEquals( '2007-06-17dsc_4173-150x150.jpg', $thumb['file'] ); 
    624         $this->assertTrue( is_file($thumb['path']) ); 
     621        $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] ); 
     622        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) ); 
    625623 
    626624        $medium = image_get_intermediate_size($id, 'medium'); 
    627         $this->assertEquals( '2007-06-17dsc_4173-400x602.jpg', $medium['file'] ); 
    628         $this->assertTrue( is_file($medium['path']) ); 
     625        $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 
     626        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 
    629627 
    630628        $meta = wp_get_attachment_metadata($id); 
    631629        $original = $meta['file']; 
    632         $this->assertTrue( is_file($original) ); 
     630        $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) ); 
    633631 
    634632        // now delete the attachment and make sure all files are gone 
Note: See TracChangeset for help on using the changeset viewer.