From 9dab851931c9ef0395df6c8be9ce5a4922cdc888 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 30 Mar 2021 19:50:11 +0000 Subject: Adjust test Signed-off-by: Lukas Reschke --- tests/lib/Http/Client/NegativeDnsCacheTest.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/lib/Http/Client/NegativeDnsCacheTest.php b/tests/lib/Http/Client/NegativeDnsCacheTest.php index 237e30865d0..b36524acf90 100644 --- a/tests/lib/Http/Client/NegativeDnsCacheTest.php +++ b/tests/lib/Http/Client/NegativeDnsCacheTest.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace Test\Http\Client; +use OC\Http\Client\NegativeDnsCache; use OCP\ICache; use OCP\ICacheFactory; @@ -42,7 +43,7 @@ class NegativeDnsCacheTest extends \Test\TestCase { $this->cache = $this->createMock(ICache::class); $this->cacheFactory = $this->createMock(ICacheFactory::class); - $this->cacheFactory->expects($this->at(0)) + $this->cacheFactory ->method('createLocal') ->with('NegativeDnsCache') ->willReturn($this->cache); @@ -51,15 +52,21 @@ class NegativeDnsCacheTest extends \Test\TestCase { } public function testSetNegativeCacheForDnsType() : void { - $this->cache->set($this->createCacheKey($domain, $type), "true", $ttl); + $this->cache + ->expects($this->once()) + ->method('set') + ->with('www.example.com-1', 'true', 3600); + + $this->negativeDnsCache->setNegativeCacheForDnsType("www.example.com", DNS_A, 3600); } public function testIsNegativeCached() { - $this->cache->expects($this->at(0)) - ->method('createDistributed') - ->with('hasKey', 'www.example.com-0') - ->willReturn($imagePathCache); + $this->cache + ->expects($this->once()) + ->method('hasKey') + ->with('www.example.com-1') + ->willReturn(true); - $this->negativeDnsCache->hasKey('www.example.com', DNS_A); + $this->assertTrue($this->negativeDnsCache->isNegativeCached("www.example.com", DNS_A)); } } -- cgit v1.2.3