/** * @covers React\Dns\Query\RecordCache * @test */ public function expireShouldExpireDeadRecords() { $cachedTime = 1345656451; $currentTime = $cachedTime + 3605; $cache = new RecordCache(); $cache->storeRecord($cachedTime, new Record('igor.io', Message::TYPE_A, Message::CLASS_IN, 3600, '178.79.169.131')); $cache->expire($currentTime); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, $currentTime); $cachedRecords = $cache->lookup($query); $this->assertCount(0, $cachedRecords); }
/** * @covers React\Dns\Query\RecordCache * @test */ public function expireShouldExpireDeadRecords() { $cachedTime = 1345656451; $currentTime = $cachedTime + 3605; $cache = new RecordCache(new ArrayCache()); $cache->storeRecord($cachedTime, new Record('igor.io', Message::TYPE_A, Message::CLASS_IN, 3600, '178.79.169.131')); $cache->expire($currentTime); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, $currentTime); $promise = $cache->lookup($query); $this->assertInstanceOf('React\\Promise\\RejectedPromise', $promise); }