예제 #1
0
 public function testGetDate()
 {
     $server = new Zend_TimeSync($this->timeservers);
     $result = $server->getDate();
     $this->assertTrue($result instanceof Zend_Date);
     $sntpServer = $server->get(5);
     $result = $sntpServer->getDate();
     $this->assertTrue($result instanceof Zend_Date);
     $timeservers = array('foo-bar.be', 'foo-bar.be');
     $server = new Zend_TimeSync($timeservers);
     try {
         $result = $server->getDate();
         $this->fail('Exception expected because of invalid timeservers');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
 }
예제 #2
0
 /**
  * Test getting a none existing timeserver
  *
  * @return void
  */
 public function testGetUnknownServer()
 {
     $server = new Zend_TimeSync();
     try {
         $result = $server->get('none_existing_server_alias');
         $this->fail('Exception expected, because the requested timeserver does not exist');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
 }