55 */
66class Tests_Option_Transient extends WP_UnitTestCase {
77
8- public function set_up () {
9- parent ::set_up ();
10-
11- if ( wp_using_ext_object_cache () ) {
12- $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
13- }
14- }
15-
168 /**
179 * @covers ::get_transient
1810 * @covers ::set_transient
@@ -63,6 +55,10 @@ public function test_serialized_data() {
6355 * @covers ::update_option
6456 */
6557 public function test_transient_data_with_timeout () {
58+ if ( wp_using_ext_object_cache () ) {
59+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
60+ }
61+
6662 $ key = rand_str ();
6763 $ value = rand_str ();
6864
@@ -88,6 +84,10 @@ public function test_transient_data_with_timeout() {
8884 * @covers ::get_transient
8985 */
9086 public function test_get_transient_with_timeout_makes_a_single_database_call () {
87+ if ( wp_using_ext_object_cache () ) {
88+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
89+ }
90+
9191 global $ wpdb ;
9292 $ key = 'test_transient ' ;
9393 $ value = 'test_value ' ;
@@ -134,6 +134,10 @@ function ( $query ) use ( &$queries ) {
134134 * @covers ::set_transient
135135 */
136136 public function test_set_transient_primes_option_cache () {
137+ if ( wp_using_ext_object_cache () ) {
138+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
139+ }
140+
137141 global $ wpdb ;
138142 $ key = 'test_transient ' ;
139143 $ value = 'test_value ' ;
@@ -170,6 +174,10 @@ function ( $query ) use ( &$queries ) {
170174 * @covers ::update_option
171175 */
172176 public function test_transient_add_timeout () {
177+ if ( wp_using_ext_object_cache () ) {
178+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
179+ }
180+
173181 $ key = rand_str ();
174182 $ value = rand_str ();
175183 $ value2 = rand_str ();
@@ -196,6 +204,10 @@ public function test_transient_add_timeout() {
196204 * @covers ::get_transient
197205 */
198206 public function test_nonexistent_key_dont_delete_if_false () {
207+ if ( wp_using_ext_object_cache () ) {
208+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
209+ }
210+
199211 // Create a bogus a transient.
200212 $ key = 'test_transient ' ;
201213 set_transient ( $ key , 'test ' , 60 * 10 );
@@ -227,6 +239,10 @@ public function test_nonexistent_key_dont_delete_if_false() {
227239 * @covers ::get_transient
228240 */
229241 public function test_nonexistent_key_old_timeout () {
242+ if ( wp_using_ext_object_cache () ) {
243+ $ this ->markTestSkipped ( 'This test requires that an external object cache is not in use. ' );
244+ }
245+
230246 // Create a transient.
231247 $ key = 'test_transient ' ;
232248 set_transient ( $ key , 'test ' , 60 * 10 );
0 commit comments