Пример #1
0
 public function testOptions()
 {
     $server = new Zend_TimeSync($this->timeservers);
     $options = array('timeout' => 1);
     $server->setOptions($options);
     $this->assertEquals(Zend_TimeSync::$options['timeout'], $server->getOption('timeout'));
     try {
         $server->setOptions(array('$' => 10));
         $this->fail('Exception expected because of invalid option key');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
     try {
         $server->setOptions('foobar');
         $this->fail('Exception expected because we did not supply an array');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
     $this->assertEquals(count($server->getOptions()), 1);
     try {
         $server->getOption('noneexistingkey');
         $this->fail('Exception expected because we supplied an unknown key');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
 }
Пример #2
0
 /**
  * Test getting an option that is not set
  *
  * @return void
  */
 public function testGetInvalidOptionKey()
 {
     $server = new Zend_TimeSync();
     try {
         $result = $server->getOptions('foobar');
         $this->fail('Exception expected because we supplied an invalid option key');
     } catch (Zend_TimeSync_Exception $e) {
         // success
     }
 }