Make WordPress Core

Changeset 904 in tests for trunk/tests/admin/includesPlugin.php


Ignore:
Timestamp:
07/18/2012 07:01:41 PM (12 years ago)
Author:
nacin
Message:

Rename tests to conform to this standard: the class Tests_A_B_C.php should be found in Tests/A/B/C.php.

One class per file. Tests are now organized by general component, rather than by the core file they are found in.

Work in progress. Some classes need to be renamed, and some files still need to be moved (and split up).

Location:
trunk/tests/admin
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/tests/admin/includesPlugin.php

    r903 r904  
    44 * @group admin
    55 */
    6 class TestPluginData extends WP_UnitTestCase {
     6class Tests_Admin_includesPlugin extends WP_UnitTestCase {
    77    function test_get_plugin_data() {
    88        $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
     
    2727        }
    2828    }
    29 }
    30 
    31 /**
    32  * @group plugins
    33  * @group admin
    34  */
    35 class TestPluginMenus extends WP_UnitTestCase {
    36 
    37     protected $current_user;
    38 
    39     function setUp() {
    40         parent::setUp();
    41         $this->current_user = get_current_user_id();
    42         // pages require manage_options, ensure we're an administrator
    43         $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    44         wp_set_current_user( $user_id );
    45         update_option( 'siteurl', 'http://example.com' );
    46     }
    47 
    48     function tearDown() {
    49         parent::tearDown();
    50         wp_set_current_user( $this->current_user );
    51     }
    5229
    5330    function test_menu_page_url() {
     31        $current_user = get_current_user_id();
     32        wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     33        update_option( 'siteurl', 'http://example.com' );
     34
    5435        // add some pages
    5536        add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
     
    7354            $this->assertEquals( $value, menu_page_url( $name, false ) );
    7455        }
     56
     57        wp_set_current_user( $current_user );
    7558    }
    7659}
Note: See TracChangeset for help on using the changeset viewer.