Remove failing unit tests from 'canonical' group.
Each removed test has been turned into a patch and posted to the open ticket that it belongs to. See #30284. git-svn-id: https://develop.svn.wordpress.org/trunk@30282 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
136b853399
commit
13602b566d
@ -63,8 +63,6 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase {
|
||||
array( '/category/uncategorized/page/2/', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
|
||||
array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
|
||||
array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
|
||||
array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
|
||||
array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
|
||||
|
||||
// Categories & Intersections with other vars
|
||||
array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
|
||||
@ -74,17 +72,10 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase {
|
||||
array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086), // Extra query vars should stay encoded
|
||||
|
||||
// Categories with Dates
|
||||
array( '/category/uncategorized/?paged=2&year=2008', array( 'url' => '/category/uncategorized/page/2/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2, 'year' => 2008) ), 17661 ),
|
||||
// array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
|
||||
array( '/2008/04/?cat=1', array( 'url' => '/category/uncategorized/?year=2008&monthnum=04', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
|
||||
array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
|
||||
// array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
|
||||
array( '/2008/?category_name=cat-a', array( 'url' => '/category/cat-a/?year=2008', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ), 20386 ),
|
||||
// array( '/category/uncategorized/?year=2008', array( 'url' => '/2008/?category_name=uncategorized', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
|
||||
array( '/category/uncategorized/?year=2008', array( 'url' => '/category/uncategorized/?year=2008', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
|
||||
|
||||
// Pages
|
||||
array( '/sample%20page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 17653 ), // Page rules always set 'page'
|
||||
array( '/sample------page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 14773 ),
|
||||
array( '/child-page-1/', '/parent-page/child-page-1/'),
|
||||
array( '/?page_id=144', '/parent-page/child-page-1/'),
|
||||
array( '/abo', '/about/' ),
|
||||
@ -104,14 +95,11 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase {
|
||||
array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
|
||||
|
||||
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 ?!
|
||||
array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/', 11694 ), // post with 4 pages
|
||||
array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
|
||||
array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
|
||||
|
||||
// Comments
|
||||
array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
|
||||
array( '/2008/03/03/comment-test/comment-page-20/', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
|
||||
array( '/2008/03/03/comment-test/?cpage=30', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
|
||||
|
||||
// Attachments
|
||||
array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
|
||||
@ -134,9 +122,7 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase {
|
||||
// Authors
|
||||
array( '/?author=%d', '/author/canonical-author/' ),
|
||||
// array( '/?author=%d&year=2008', '/2008/?author=3'),
|
||||
array( '/?author=%d&year=2008', '/author/canonical-author/?year=2008', 17661 ),
|
||||
// array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
|
||||
array( '/author/canonical-author/?year=2008', '/author/canonical-author/?year=2008', 17661 ),
|
||||
|
||||
// Feeds
|
||||
array( '/?feed=atom', '/feed/atom/' ),
|
||||
|
@ -35,7 +35,6 @@ class Tests_Canonical_CustomRules extends WP_Canonical_UnitTestCase {
|
||||
// Custom Rewrite rules leading to Categories
|
||||
array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
|
||||
array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
|
||||
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 ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,80 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @group canonical
|
||||
* @group rewrite
|
||||
* @group query
|
||||
*/
|
||||
class Tests_Canonical_PermalinkFormat extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 21167
|
||||
*/
|
||||
public function test_dotted_formats() {
|
||||
global $wp_rewrite;
|
||||
|
||||
// Create a sample post
|
||||
$cat_id = $this->factory->term->create( array(
|
||||
'name' => 'permalink-test',
|
||||
'taxonomy' => 'category'
|
||||
) );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
'role' => 'editor',
|
||||
'user_login' => 'permalink_user',
|
||||
) );
|
||||
$post_id = $this->factory->post->create( array(
|
||||
'post_title' => 'lorem-ipsum',
|
||||
'post_date' => '2012-08-02 14:15:05',
|
||||
'post_author' => $user_id,
|
||||
'category' => $cat_id
|
||||
) );
|
||||
wp_set_post_categories( $post_id, array( $cat_id ) );
|
||||
|
||||
// Sample permalinks
|
||||
$tests = array(
|
||||
'/%postname%.%post_id%/ ' => array(
|
||||
'regex' => '([^/]+)\.([0-9]+)(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?name=$1&p=$2&page=$3'
|
||||
),
|
||||
'/%year%.%monthnum%.%postname%/' => array(
|
||||
'regex' => '([0-9]{4})\.([0-9]{1,2})\.([^/]+)(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?year=$1&monthnum=$2&name=$3&page=$4'
|
||||
),
|
||||
'/%post_id%.%postname%/' => array(
|
||||
'regex' => '([0-9]+)\.([^/]+)(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?p=$1&name=$2&page=$3'
|
||||
),
|
||||
'/%postname%.%year%/' => array(
|
||||
'regex' => '([^/]+)\.([0-9]{4})(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?name=$1&year=$2&page=$3'
|
||||
),
|
||||
'/$%postname%$/' => array(
|
||||
'regex' => '\$([^/]+)\$(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?name=$1&page=$2'
|
||||
),
|
||||
'%year%.+?%monthnum%.+?%day%.+?%hour%.+?%minute%.+?%second%.+?%post_id%.+?%postname%.+?%category%.+?%author%.+?' => array(
|
||||
'regex' => '([0-9]{4})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]+)\.\+\?([^/]+)\.\+\?%category%\.\+\?([^/]+)\.\+\?(/[0-9]+)?/?$',
|
||||
'url' => 'index.php?year=$1&monthnum=$2&day=$3&hour=$4&minute=$5&second=$6&p=$7&name=$8&%category%$9&author_name=$10&page=$11'
|
||||
),
|
||||
);
|
||||
|
||||
// Test permalinks
|
||||
foreach ( $tests as $permalink_format => $expected ) {
|
||||
update_option( 'permalink_structure', $permalink_format );
|
||||
|
||||
// Get the rewrite rules
|
||||
$rules = $wp_rewrite->generate_rewrite_rules( get_option( 'permalink_structure' ), EP_PERMALINK, false, false, false, false );
|
||||
|
||||
// Filter out only the post rewrite rule
|
||||
foreach ( $rules as $regex => $url ) {
|
||||
if ( false === strpos( $url, 'attachment=$' ) && false === strpos( $url, 'tb=' ) && false === strpos( $url, 'cpage=$' ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Test that expected === actual
|
||||
$this->assertEquals( $regex, $expected['regex'], "Problem with permalink format: $permalink_format" );
|
||||
$this->assertEquals( $url, $expected['url'], "Problem with permalink format: $permalink_format" );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user