From 79dc7efc73babed57afa596e2566b3bd518599c0 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 2 Oct 2015 05:09:03 +0000 Subject: [PATCH] Unit Tests: when `wp_using_ext_object_cache()`, mark some transient tests as skipped. Props ocean90. See #31491. git-svn-id: https://develop.svn.wordpress.org/trunk@34767 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/option/siteTransient.php | 8 +++++++ tests/phpunit/tests/option/transient.php | 24 +++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/phpunit/tests/option/siteTransient.php b/tests/phpunit/tests/option/siteTransient.php index 621b2c1b31..ef7acc34f0 100644 --- a/tests/phpunit/tests/option/siteTransient.php +++ b/tests/phpunit/tests/option/siteTransient.php @@ -5,6 +5,14 @@ */ class Tests_Option_SiteTransient extends WP_UnitTestCase { + public function setUp() { + parent::setUp(); + + if ( wp_using_ext_object_cache() ) { + $this->markTestSkipped( 'Not testable with an external object cache.' ); + } + } + function test_the_basics() { $key = rand_str(); $value = rand_str(); diff --git a/tests/phpunit/tests/option/transient.php b/tests/phpunit/tests/option/transient.php index 3dbd79d6d6..06833b6830 100644 --- a/tests/phpunit/tests/option/transient.php +++ b/tests/phpunit/tests/option/transient.php @@ -5,6 +5,14 @@ */ class Tests_Option_Transient extends WP_UnitTestCase { + public function setUp() { + parent::setUp(); + + if ( wp_using_ext_object_cache() ) { + $this->markTestSkipped( 'Not testable with an external object cache.' ); + } + } + function test_the_basics() { $key = rand_str(); $value = rand_str(); @@ -42,10 +50,6 @@ class Tests_Option_Transient extends WP_UnitTestCase { $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' ); } - if ( wp_using_ext_object_cache() ) { - $this->markTestSkipped( 'Not testable with an external object cache.' ); - } - $key = rand_str(); $value = rand_str(); @@ -71,10 +75,6 @@ class Tests_Option_Transient extends WP_UnitTestCase { $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' ); } - if ( wp_using_ext_object_cache() ) { - $this->markTestSkipped( 'Not testable with an external object cache.' ); - } - $key = rand_str(); $value = rand_str(); $value2 = rand_str(); @@ -98,10 +98,6 @@ class Tests_Option_Transient extends WP_UnitTestCase { * @ticket 30380 */ function test_nonexistent_key_dont_delete_if_false() { - if ( wp_using_ext_object_cache() ) { - $this->markTestSkipped( 'Not testable with an external object cache.' ); - } - // Create a bogus a transient $key = 'test_transient'; set_transient( $key, 'test', 60 * 10 ); @@ -134,10 +130,6 @@ class Tests_Option_Transient extends WP_UnitTestCase { $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' ); } - if ( wp_using_ext_object_cache() ) { - $this->markTestSkipped( 'Not testable with an external object cache.' ); - } - // Create a transient $key = 'test_transient'; set_transient( $key, 'test', 60 * 10 );