コード例 #1
0
ファイル: RecordCacheTest.php プロジェクト: pvelly/CGParty
 /**
  * @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);
 }
コード例 #2
0
ファイル: RecordCacheTest.php プロジェクト: abhay26/dns
 /**
  * @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);
 }