public function testGetAuthTokenApprovalClass() { $dbCon = getDbCon(); $trust_key = "Ringside234534253245235325"; $result = RingsideSocialDbSession::getTrustAuthority($trust_key); $this->assertNull($result); $sql = "INSERT INTO rs_trust_authorities (trust_key, trust_name, trust_auth_url, trust_auth_class) VALUES ('Ringside', 'Ringside Local', 'localhost/api/restserver.php', '')"; mysql_query($sql, $dbCon); $trust_key = "Ringside"; $result = RingsideSocialDbSession::getTrustAuthority($trust_key); $this->assertEquals($result['trust_key'], 'Ringside'); $this->assertEquals($result['trust_name'], 'Ringside Local'); $this->assertEquals($result['trust_auth_url'], 'localhost/api/restserver.php'); $this->assertEquals($result['trust_auth_class'], ''); }
/** * TODO: This only works for facebook style authentication. For other types we need to use trust_auth_class * look it up and then call it to authorize us. * * @param unknown_type $trust_key * @return unknown */ public function getAuthUrl($trust_key) { // TODO: Mark, need to add facebook trust key, right now test is not working because of it. if (!isset($trust_key)) { $trust_key = RingsideSocialUtils::DEFAULT_TRUST_KEY; } $info = RingsideSocialDbSession::getTrustAuthority($trust_key); // trust_key, trust_name, trust_auth_class, trust_auth_url if (isset($info)) { $url = $info['trust_auth_url']; if (isset($url)) { return $url; } } // If all else fails return null, this will probably result in localhost being used return null; //return "api.facebook.com/restserver.php"; }