From 944a6845a251cd52e1c4e18f290a3a9402d0b08b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 6 Sep 2020 03:35:59 +0000 Subject: [PATCH] Tests: Correct assertion in `Tests_Cache::test_add_get_null()`. It is possible to store `null` in the cache without it being converted to an empty string. Follow-up to [20089]. Props johnbillion, SergeyBiryukov. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48949 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/cache.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php index c47ce4a8da..740332503c 100644 --- a/tests/phpunit/tests/cache.php +++ b/tests/phpunit/tests/cache.php @@ -43,7 +43,7 @@ class Tests_Cache extends WP_UnitTestCase { $val = 0; // You can store zero in the cache. - $this->cache->add( $key, $val ); + $this->assertTrue( $this->cache->add( $key, $val ) ); $this->assertSame( $val, $this->cache->get( $key ) ); } @@ -51,9 +51,9 @@ class Tests_Cache extends WP_UnitTestCase { $key = __FUNCTION__; $val = null; + // You can store null in the cache. $this->assertTrue( $this->cache->add( $key, $val ) ); - // Null is converted to empty string. - $this->assertEquals( '', $this->cache->get( $key ) ); + $this->assertSame( $val, $this->cache->get( $key ) ); } function test_add() {