Skip to content

Commit

Permalink
Only run this test when Redis is connected
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed Aug 17, 2020
1 parent 6f8b351 commit b9f30ed
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tests/phpunit/test-cache.php
Expand Up @@ -789,6 +789,9 @@ public function test_get_multiple() {
}

public function test_get_multiple_partial_cache_miss() {
if ( ! class_exists( 'Redis' ) ) {
$this->markTestSkipped( 'Requires an active persistent object cache connection' );
}
$this->cache->set( 'foo1', 'bar', 'group1' );
$this->cache->set( 'foo2', 'baz', 'group1' );
$this->cache->set( 'foo3', 'bap', 'group1' );
Expand All @@ -809,18 +812,14 @@ public function test_get_multiple_partial_cache_miss() {
$this->assertSame( $expected, $found );
$this->assertEquals( 4, $this->cache->cache_hits );
$this->assertEquals( 1, $this->cache->cache_misses );
if ( $this->cache->is_redis_connected ) {
$this->assertEquals(
array(
self::$get_key => 1,
self::$mget_key => 1,
self::$set_key => 3,
),
$this->cache->redis_calls
);
} else {
$this->assertEmpty( $this->cache->redis_calls );
}
$this->assertEquals(
array(
self::$get_key => 1,
self::$mget_key => 1,
self::$set_key => 3,
),
$this->cache->redis_calls
);
}

public function test_get_multiple_non_persistent() {
Expand Down

0 comments on commit b9f30ed

Please sign in to comment.