WordPress.org

Make WordPress Core

Changeset 365 in tests


Ignore:
Timestamp:
06/03/11 05:17:22 (4 years ago)
Author:
dd32
Message:

3rd wave of Canonical tests. Custom Rewrite rule for Taxonomies, Post Paging w/ GET and redirects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_canonical.php

    r364 r365  
    1717        $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); 
    1818        create_initial_taxonomies(); 
     19        $wp_rewrite->add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule 
     20 
    1921        $wp_rewrite->flush_rules(); 
    2022         
     
    6971        if ( isset($expected['url']) ) 
    7072            $this->assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref ); 
    71          
    72         // request url is correct, Next, "make" that the request and check the query is correct 
    73         $this->http( $can_url ); 
    7473     
    7574        if ( isset($expected['qv']) ) {  
     75 
     76            // "make" that the request and check the query is correct 
     77            $this->http( $can_url ); 
     78 
    7679            // Are all query vars accounted for, And correct? 
    7780            global $wp; 
     
    116119                array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ), 17661 ), 
    117120                array( '/category/uncategorized/?year=2008', array( 'url' => '/2008/?category_name=uncategorized', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ), 
    118                  
     121 
     122                // Custom Rewrite rules leading to Categories 
     123                array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ), 
     124                array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ), 
     125                array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' => '/ccr/uncategorized/sort/desc/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc', 'year' => '2008' ) ), 17661 ), 
     126 
    119127                // Pages 
    120128                array( '/sample%20page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 17653 ), // Page rules always set 'page' 
     
    138146                array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/3' ) ) ), // page = /3 ?! 
    139147                array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/' ), // post with 4 pages 
     148                array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ), 
     149                array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ), 
    140150 
    141151                // Attachments 
     
    161171                array( '/author/chip-bennett/?year=2008', '/2008/?author=3'), //Either or, see previous testcase. 
    162172                 
     173                // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static) 
    163174 
    164175                ); 
Note: See TracChangeset for help on using the changeset viewer.