/** * @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; }
/** * @covers Robo47_Service_Bitly::setCallback * @covers Robo47_Service_Bitly::getCallback */ public function testSetCallbackGetCallback() { $service = new Robo47_Service_Bitly('login', 'apiKey'); $this->assertEquals('', $service->getCallback(), 'Wrong callback'); $return = $service->setCallback('foo'); $this->assertSame($return, $service, 'No Fluent Interface'); $this->assertEquals('foo', $service->getCallback(), 'Wrong callback'); }