예제 #1
0
 /**
  * @param array $options
  * @return Robo47_Service_Bitly
  */
 protected function _setupService($options)
 {
     if (!isset($options['login'])) {
         $message = 'No login provided';
         throw new Robo47_Application_Resource_Exception($message);
     }
     if (!isset($options['apiKey'])) {
         $message = 'No apiKey provided';
         throw new Robo47_Application_Resource_Exception($message);
     }
     $bitly = new Robo47_Service_Bitly($options['login'], $options['apiKey']);
     if (isset($options['format'])) {
         $bitly->setFormat($options['format']);
     }
     if (isset($options['resultFormat'])) {
         $bitly->setResultFormat($options['resultFormat']);
     }
     if (isset($options['callback'])) {
         $bitly->setCallback($options['callback']);
     }
     if (isset($options['version'])) {
         $bitly->setVersion($options['version']);
     }
     if (isset($options['registryKey'])) {
         Zend_Registry::set($options['registryKey'], $bitly);
     }
     return $bitly;
 }
예제 #2
0
 /**
  * @covers Robo47_Service_Bitly::setVersion
  * @covers Robo47_Service_Bitly::getVersion
  */
 public function testSetVersionGetVersion()
 {
     $service = new Robo47_Service_Bitly('login', 'apiKey');
     $this->assertEquals('2.0.1', $service->getVersion(), 'Wrong version');
     $return = $service->setVersion('1.2.3');
     $this->assertSame($return, $service, 'No Fluent Interface');
     $this->assertEquals('1.2.3', $service->getVersion(), 'Wrong version');
 }