mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Privacy: Introduce Privacy Policy page helpers:
* `is_privacy_policy()` template tag * `privacy-policy.php` template * `.privacy-policy` body class * `.menu-item-privacy-policy` menu item class Props garrett-eclipse, birgire, xkon, Clorith. Fixes #44005. git-svn-id: https://develop.svn.wordpress.org/trunk@44966 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -13,6 +13,15 @@ class Tests_Template extends WP_UnitTestCase {
|
||||
protected static $page;
|
||||
protected static $post;
|
||||
|
||||
/**
|
||||
* Page For Privacy Policy.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @var WP_Post $page_for_privacy_policy
|
||||
*/
|
||||
protected static $page_for_privacy_policy;
|
||||
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
self::$page_on_front = $factory->post->create_and_get(
|
||||
array(
|
||||
@@ -45,6 +54,13 @@ class Tests_Template extends WP_UnitTestCase {
|
||||
);
|
||||
set_post_format( self::$post, 'quote' );
|
||||
add_post_meta( self::$post->ID, '_wp_page_template', 'templates/post.php' );
|
||||
|
||||
self::$page_for_privacy_policy = $factory->post->create_and_get(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_title' => 'Privacy Policy',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
@@ -272,6 +288,25 @@ class Tests_Template extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 44005
|
||||
* @group privacy
|
||||
*/
|
||||
public function test_privacy_template_hierarchy() {
|
||||
update_option( 'wp_page_for_privacy_policy', self::$page_for_privacy_policy->ID );
|
||||
|
||||
$this->assertTemplateHierarchy(
|
||||
get_permalink( self::$page_for_privacy_policy->ID ),
|
||||
array(
|
||||
'privacy-policy.php',
|
||||
'page-privacy-policy.php',
|
||||
'page-' . self::$page_for_privacy_policy->ID . '.php',
|
||||
'page.php',
|
||||
'singular.php',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 18375
|
||||
*/
|
||||
@@ -436,6 +471,7 @@ class Tests_Template extends WP_UnitTestCase {
|
||||
'search' => 'is_search',
|
||||
'front_page' => 'is_front_page',
|
||||
'home' => 'is_home',
|
||||
'privacy_policy' => 'is_privacy_policy',
|
||||
'post_type_archive' => 'is_post_type_archive',
|
||||
'taxonomy' => 'is_tax',
|
||||
'attachment' => 'is_attachment',
|
||||
|
||||
Reference in New Issue
Block a user