Make WordPress Core

Ticket #14773: tests.14773.1.diff

File tests.14773.1.diff, 1.7 KB (added by atimmer, 12 years ago)
  • tests/tests/canonical/corectResolving.php

     
     1<?php
     2
     3require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
     4
     5/**
     6 * Tests if redirect_canonical redirects URL's that should be resolved to this slug correctly
     7 *
     8 * @group canonical
     9 * @group rewrite
     10 * @group query
     11 */
     12class Tests_Canonical_CorrectResolving extends Tests_Canonical {
     13
     14        var $structure = '/%postname%/';
     15
     16        function setUp() {
     17                parent::setUp();
     18
     19                $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'long-slug', 'post_name' => 'this-should-be-resolved' ) );
     20        }
     21
     22        function data() {
     23                /* Format:
     24                 * [0]: $test_url,
     25                 * [1]: expected results: Any of the following can be used
     26                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
     27                 *      array( expected query vars to be set, same as 'qv' above )
     28                 *      (string) expected redirect location
     29                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
     30                 */
     31                 return array(
     32                         // Check against an odd redirect
     33                         array( '/this-should-be-', '/this-should-be-resolved/', ),
     34                         array( '/this--should-be-resolved-', '/this-should-be-resolved/', 14773 ),
     35                         array( '/this----should---be---resolved-', '/this-should-be-resolved/', 14773 ),
     36                         array( '/this-------------------', '/this-should-be-resolved/', ),
     37                         array( '/----------this', '/this-should-be-resolved/', ),
     38                         array( '/---this---should---be-', '/this-should-be-resolved/', ),
     39                 );
     40        }
     41}