WordPress.org

Make WordPress Core

Changeset 827 in tests


Ignore:
Timestamp:
06/30/12 22:47:21 (22 months ago)
Author:
nacin
Message:

Port test_includes_post.php. Includes some test failures in WPTestAttachments. see #89.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-testcase/test_includes_post.php

    r741 r827  
    33// test wp-includes/post.php 
    44 
    5 class WPTestIncludesPost extends WPTestCase { 
     5class WPTestIncludesPost extends WP_UnitTestCase { 
    66    function setUp() { 
    77        parent::setUp(); 
    8         $this->author_id = $this->_make_user('editor'); 
     8        $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) ); 
    99        $this->old_current_user = get_current_user_id(); 
    1010        wp_set_current_user( $this->author_id ); 
     
    1414 
    1515    function tearDown() { 
     16        wp_set_current_user( $this->old_current_user ); 
    1617        parent::tearDown(); 
    17         foreach ($this->post_ids as $id) 
    18             wp_delete_post($id); 
    19         $this->_destroy_user( $this->author_id ); 
    20         wp_set_current_user( $this->old_current_user ); 
    2118    } 
    2219 
     
    470467} 
    471468 
    472 class WPTestAttachments extends _WPEmptyBlog { 
     469class WPTestAttachments extends WP_UnitTestCase { 
    473470 
    474471    function tearDown() { 
     
    480477        update_option('thumbnail_size_h', 150); 
    481478 
    482         $this->_destroy_uploads(); 
     479        // Remove all uploads. 
     480        $uploads = wp_upload_dir();  
     481        foreach ( scandir( $uploads['basedir'] ) as $file ) 
     482            _rmdir( $uploads['basedir'] . '/' . $file );  
    483483    } 
    484484 
     
    674674} 
    675675 
    676 class WPTestPostMeta extends WPTestCase { 
     676class WPTestPostMeta extends WP_UnitTestCase { 
    677677    function setUp() { 
    678678        parent::setUp(); 
    679679 
    680         $this->author = new WP_User( $this->_make_user('editor') ); 
     680        $this->author = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) ); 
    681681 
    682682        $post = array( 
     
    914914} 
    915915 
    916 class WPTestPostTypes extends WPTestCase { 
     916class WPTestPostTypes extends WP_UnitTestCase { 
    917917    function setUp() { 
    918918        parent::setUp(); 
Note: See TracChangeset for help on using the changeset viewer.