WordPress.org

Make WordPress Core

Changeset 326 in tests


Ignore:
Timestamp:
01/20/2011 08:22:56 AM (7 years ago)
Author:
duck_
Message:

Corrections in TestPluginMenus for #WP14159, fixes #10

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_admin_includes_plugin.php

    r309 r326  
    11<?php
    22class TestPluginData extends WPTestCase {
     3    function test_get_plugin_data() {
     4        $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
    35
    4     function test_get_plugin_data() {
    5         $data = get_plugin_data(DIR_TESTDATA . '/plugins/hello.php');
     6        $default_headers = array(
     7            'Name' => 'Hello Dolly',
     8            'Title' => '<a href="http://wordpress.org/#" title="Visit plugin homepage">Hello Dolly</a>',
     9            'PluginURI' => 'http://wordpress.org/#',
     10            'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. By <a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>.',
     11            'Author' => '<a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>',
     12            'AuthorURI' => 'http://ma.tt/',
     13            'Version' => '1.5.1',
     14            'TextDomain' => 'hello-dolly',
     15            'DomainPath' => ''
     16        );
    617
    7         $default_headers = array(   'Name' => 'Hello Dolly',
    8                                     'Title' => '<a href="http://wordpress.org/#" title="Visit plugin homepage">Hello Dolly</a>',
    9                                     'PluginURI' => 'http://wordpress.org/#',
    10                                     'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. By <a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>.',
    11                                     'Author' => '<a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>',
    12                                     'AuthorURI' => 'http://ma.tt/',
    13                                     'Version' => '1.5.1',
    14                                     'TextDomain' => 'hello-dolly',
    15                                     'DomainPath' => ''
    16                                 );
    17        
    18         $this->assertTrue(is_array($data));
    19        
     18        $this->assertTrue( is_array($data) );
     19
    2020        foreach ($default_headers as $name => $value) {
    2121            $this->assertTrue(isset($data[$name]));
     
    2727class TestPluginMenus extends _WPEmptyBlog {
    2828    function test_menu_page_url() {
    29         $this->knownWPBug(13829);
    3029        $user = wp_get_current_user();
    3130        wp_set_current_user(1);
    32        
     31
    3332        //Add some pages
    34         add_options_page('Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page');
    35         add_management_page('Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page');
    36         add_menu_page('Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
    37         add_submenu_page('mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page');
    38         add_submenu_page('mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2');
    39         add_theme_page('With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page');
    40         add_pages_page('Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
    41        
    42         //TODO: review the http://null.host/ here and work out if this is portable enough for testing on other hosts
    43         $expected['testsettings'] = 'http://null.host/wp-admin/options-general.php?page=testsettings';
    44         $expected['testtools'] = 'http://null.host/wp-admin/tools.php?page=testtools';
    45         $expected['mt-top-level-handle'] = 'http://null.host/wp-admin/admin.php?page=mt-top-level-handle';
    46         $expected['sub-page'] = 'http://null.host/wp-admin/mt-top-level-handle?page=sub-page';
    47         $expected['sub-page2'] = 'http://null.host/wp-admin/mt-top-level-handle?page=sub-page2';
    48         $expected['not_registered'] = '';
    49         $expected['With Spaces'] = 'http://null.host/wp-admin/themes.php?page=WithSpaces';
    50         $expected['testpages'] = 'http://null.host/wp-admin/edit.php?post_type=page&#038;page=testpages';
     33        add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
     34        add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
     35        add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
     36        add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
     37        add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
     38        add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
     39        add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
     40
     41        $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
     42        $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
     43        $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
     44        $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
     45        $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
     46        $expected['not_registered'] = '';
     47        $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
     48        $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&#038;page=testpages';
    5149
    5250        foreach ($expected as $name => $value) {
    53             $this->assertEquals($value, menu_page_url($name, false) );
     51            $this->assertEquals( $value, menu_page_url( $name, false ) );
    5452        }
    55        
     53
    5654        wp_set_current_user($user->ID);
    5755    }
Note: See TracChangeset for help on using the changeset viewer.