Changeset 42343 for trunk/tests/phpunit/tests/canonical/category.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/canonical/category.php
r38398 r42343 8 8 9 9 public static $posts = array(); 10 public static $cats = array();10 public static $cats = array(); 11 11 12 12 public static function wpSetUpBeforeClass( $factory ) { … … 14 14 self::$posts[0] = $factory->post->create( array( 'post_name' => 'post0' ) ); 15 15 self::$posts[1] = $factory->post->create( array( 'post_name' => 'post1' ) ); 16 self::$cats[0] = $factory->category->create( array( 'slug' => 'cat0' ) );17 self::$cats[1] = $factory->category->create( array( 'slug' => 'cat1' ) );18 self::$cats[2] = $factory->category->create( array( 'slug' => 'cat2' ) );16 self::$cats[0] = $factory->category->create( array( 'slug' => 'cat0' ) ); 17 self::$cats[1] = $factory->category->create( array( 'slug' => 'cat1' ) ); 18 self::$cats[2] = $factory->category->create( array( 'slug' => 'cat2' ) ); 19 19 20 20 wp_set_post_categories( self::$posts[0], self::$cats[2] ); … … 43 43 return array( 44 44 // Valid category. 45 array( '/cat0/post0/', array( 'url' => '/cat0/post0/', 'qv' => array( 'category_name' => 'cat0', 'name' => 'post0', 'page' => '' ) ) ), 45 array( 46 '/cat0/post0/', 47 array( 48 'url' => '/cat0/post0/', 49 'qv' => array( 50 'category_name' => 'cat0', 51 'name' => 'post0', 52 'page' => '', 53 ), 54 ), 55 ), 46 56 47 57 // Category other than the first one will redirect to first "canonical" category. 48 array( '/cat2/post0/', array( 'url' => '/cat0/post0/', 'qv' => array( 'category_name' => 'cat0', 'name' => 'post0', 'page' => '' ) ) ), 58 array( 59 '/cat2/post0/', 60 array( 61 'url' => '/cat0/post0/', 62 'qv' => array( 63 'category_name' => 'cat0', 64 'name' => 'post0', 65 'page' => '', 66 ), 67 ), 68 ), 49 69 50 70 // Incorrect category will redirect to correct one. 51 array( '/cat1/post0/', array( 'url' => '/cat0/post0/', 'qv' => array( 'category_name' => 'cat0', 'name' => 'post0', 'page' => '' ) ) ), 71 array( 72 '/cat1/post0/', 73 array( 74 'url' => '/cat0/post0/', 75 'qv' => array( 76 'category_name' => 'cat0', 77 'name' => 'post0', 78 'page' => '', 79 ), 80 ), 81 ), 52 82 53 83 // Nonexistent category will redirect to correct one. 54 array( '/foo/post0/', array( 'url' => '/cat0/post0/', 'qv' => array( 'category_name' => 'cat0', 'name' => 'post0', 'page' => '' ) ) ), 84 array( 85 '/foo/post0/', 86 array( 87 'url' => '/cat0/post0/', 88 'qv' => array( 89 'category_name' => 'cat0', 90 'name' => 'post0', 91 'page' => '', 92 ), 93 ), 94 ), 55 95 56 96 // Embed URLs should not redirect to post permalinks. 57 array( '/cat0/post0/embed/', array( 'url' => '/cat0/post0/embed/', 'qv' => array( 'category_name' => 'cat0', 'name' => 'post0', 'embed' => 'true' ) ) ), 97 array( 98 '/cat0/post0/embed/', 99 array( 100 'url' => '/cat0/post0/embed/', 101 'qv' => array( 102 'category_name' => 'cat0', 103 'name' => 'post0', 104 'embed' => 'true', 105 ), 106 ), 107 ), 58 108 ); 59 109 }
Note: See TracChangeset
for help on using the changeset viewer.