Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-03-30 22:50:11 +0300
committerGitHub <noreply@github.com>2021-04-06 14:37:47 +0300
commit9dab851931c9ef0395df6c8be9ce5a4922cdc888 (patch)
tree670b8537ba117efb867a9bb4ea1c3a6de99c542e /tests
parent5f3abffe6f37b4f8639fde8bcaf35d873a17636c (diff)
Adjust test
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Http/Client/NegativeDnsCacheTest.php21
1 files changed, 14 insertions, 7 deletions
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));
}
}