Пример #1
0
 /**
  * Setup Gravatar
  *
  * @param array $options
  * @return Robo47_Service_Gravatar
  */
 protected function _setupService($options)
 {
     $gravatar = new Robo47_Service_Gravatar();
     if (isset($options['rating'])) {
         $gravatar->setRating($options['rating']);
     }
     if (isset($options['size'])) {
         $gravatar->setSize($options['size']);
     }
     if (isset($options['default'])) {
         $gravatar->setDefault($options['default']);
     }
     if (isset($options['cachePrefix'])) {
         $gravatar->setCachePrefix($options['cachePrefix']);
     }
     if (isset($options['useSSL'])) {
         $gravatar->useSSL($options['useSSL']);
     }
     if (isset($options['cache'])) {
         $gravatar->setCache($options['cache']);
     }
     if (isset($options['registryKey'])) {
         Zend_Registry::set($options['registryKey'], $gravatar);
     }
     return $gravatar;
 }
Пример #2
0
 /**
  * @covers Robo47_Service_Gravatar::setRating
  */
 public function testSetInvalidRating()
 {
     $service = new Robo47_Service_Gravatar();
     try {
         $service->setRating('a');
         $this->fail('no exception thrown setRating() with invalid rating');
     } catch (Robo47_Service_Gravatar_Exception $e) {
         $this->assertEquals('Invalid rating: a', $e->getMessage(), 'Wrong exception message');
     }
 }