Make WordPress Core

Changeset 34654


Ignore:
Timestamp:
09/28/2015 12:46:19 AM (8 years ago)
Author:
DrewAPicture
Message:

Tests: Add a test for the 'before' and 'after' arguments in wp_page_menu() when used as a fallback for wp_nav_menu().

When wp_page_menu() is used as a fallback for wp_nav_menu(), the before and after arguments should be set and output as <ul> and </ul>, respectively.

See #11095. See [34653].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/template.php

    r32727 r34654  
    11<?php
    22
     3/**
     4 * @group template
     5 */
    36class Tests_Post_Template extends WP_UnitTestCase {
    47
     
    276279        $this->assertFalse( get_page_template_slug() );
    277280    }
     281
     282    /**
     283     * @ticket 11095
     284     */
     285    public function test_wp_page_menu_wp_nav_menu_fallback() {
     286        $pages = $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
     287
     288        // No menus + wp_nav_menu() falls back to wp_page_menu().
     289        $menu = wp_nav_menu( array( 'echo' => false ) );
     290
     291        // After falling back, the 'before' argument should be set and output as '<ul>'.
     292        $this->assertRegExp( '/<div class="menu"><ul>/', $menu );
     293
     294        // After falling back, the 'after' argument should be set and output as '</ul>'.
     295        $this->assertRegExp( '/<\/ul><\/div>/', $menu );
     296    }
    278297}
Note: See TracChangeset for help on using the changeset viewer.