示例#1
0
 /**
  * @param string $username
  * @param integer $count [currently unused]
  * @param integer $cachetime
  * @return string
  */
 public function fetchSensioProfileData($username, $cachetime = 500)
 {
     try {
         $profile = get_transient(R47SENSIOCONNECT_TRANSIENT_PREFIX . $username . '_' . $cachetime);
         if (!$profile) {
             $scp = new Robo47_Wordpress_SensioConnect();
             $profile = $scp->fetchSensioProfile($username);
             set_transient(R47SENSIOCONNECT_TRANSIENT_PREFIX . $username . '_' . $cachetime, $profile, $cachetime);
         }
     } catch (Exception $e) {
         // ignore anything - just return empty string - we are doing frontend stuff! :)
         return '';
     }
     return $profile;
 }
 /**
  * @covers Robo47_Wordpress_SensioConnect::__construct
  * @covers Robo47_Wordpress_SensioConnect::setHttp
  * @covers Robo47_Wordpress_SensioConnect::getHttp
  */
 public function test__constructWithHttp()
 {
     $http = new Robo47_Http_MockSimple();
     $sensioConnect = new Robo47_Wordpress_SensioConnect($http);
     $this->assertSame($http, $sensioConnect->getHttp());
 }