mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Coding Standards: Disable WPCS warnings for date_default_timezone_set() and current_time( 'timestamp' ) calls in Date/Time tests.
These calls are intentional and required for the tests. See #49222. git-svn-id: https://develop.svn.wordpress.org/trunk@47118 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -10,6 +10,7 @@ class Tests_Date_Get_Permalink extends WP_UnitTestCase {
|
||||
function tearDown() {
|
||||
delete_option( 'permalink_structure' );
|
||||
update_option( 'timezone_string', 'UTC' );
|
||||
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
|
||||
date_default_timezone_set( 'UTC' );
|
||||
|
||||
parent::tearDown();
|
||||
@@ -22,6 +23,7 @@ class Tests_Date_Get_Permalink extends WP_UnitTestCase {
|
||||
$timezone = 'America/Chicago';
|
||||
update_option( 'timezone_string', $timezone );
|
||||
update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%hour%/%minute%/%second%' );
|
||||
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
|
||||
date_default_timezone_set( 'UTC' );
|
||||
|
||||
$post_id = self::factory()->post->create(
|
||||
@@ -33,6 +35,7 @@ class Tests_Date_Get_Permalink extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
|
||||
|
||||
// phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set
|
||||
date_default_timezone_set( $timezone );
|
||||
$this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user