/**
  * @group create
  * @group nc
  */
 public function testCreate()
 {
     $subject = "Here is the subject of a broadcast message. " . rand(1, 100000);
     $body = "Here is the body of a broadcast message.";
     $result = NingApi::instance()->broadcastMessage->createMessage($subject, $body);
     $this->assertTrue($result['success']);
 }
 public function testCount_old()
 {
     date_default_timezone_set("UTC");
     $date = date("Y-m-d\\TH:i:s\\Z", strtotime("-2 days"));
     $path = sprintf("Activity/count?createdAfter=%s", $date);
     $result = NingApi::instance()->get($path);
     $this->assertTrue($result['success']);
 }
 public function testAlpha_old()
 {
     $count = 3;
     $fields = "name";
     $path = sprintf("Network/alpha?count=%s&fields=%s", $count, $fields);
     $result = NingApi::instance()->get($path);
     $this->assertTrue($result['success']);
 }
 /**
  * @group delete
  */
 public function testDelete()
 {
     $args = array();
     $blogPosts = NingApi::instance()->blogPost->fetchNRecent();
     $args['attachedTo'] = $blogPosts['entry'][0]['id'];
     $args['description'] = "This is a test comment.";
     $newComment = NingApi::instance()->comment->create($args);
     $args = array('id' => $newComment['id']);
     $result = NingApi::instance()->comment->delete($args);
     $this->assertTrue($result['success']);
 }
Exemple #5
0
 protected function fetchAlphabetical($args = array())
 {
     $path = $this->objectKey . '/' . self::ALPHA;
     $this->addDefaultFields($args);
     return NingApi::instance()->get($path, $args);
 }
Exemple #6
0
 public function login($email, $password)
 {
     try {
         $this->_requireUserSpecificData(array('subdomain', 'consumerKey', 'consumerSecret'));
     } catch (Exception $e) {
         $message = $e->getMessage();
         throw new NingException("You must specify the subdomain, consumerKey, and consumerSecret before calling login(). " . $message);
     }
     $this->email = $email;
     $this->password = $password;
     $credentials = base64_encode($email . ':' . $password);
     $headers = array('Authorization: Basic ' . $credentials);
     $result = $this->post('Token', NULL, $headers, true);
     $this->setRequestTokens($result['entry']['oauthToken'], $result['entry']['oauthTokenSecret']);
     self::$_instance = $this;
     return $result;
 }
 private function getContentId()
 {
     $client = NingApi::instance();
     $result = $client->blogPost->fetchNRecent(self::FETCH_COUNT);
     return $result['entry'][0]['id'];
 }
 public function testFetchRecentNextPage()
 {
     $result = NingApi::instance()->friend->fetchRecentNextPage();
     $this->assertTrue($result['success']);
 }