Exemplo n.º 1
0
 public function testUpdateTag()
 {
     $obj = VoxbBase::getInstance();
     $profile = new VoxbProfile();
     $profile->setUserId($this->users[0]);
     $profile->fetchMyData();
     // add a new tag (and keep old tags)
     $tag = new VoxbTagRecord();
     $this->assertTrue($tag->create('111111111', 'tag_new', $profile));
     $item = new VoxbItem();
     $item->fetchByFaust('111111111');
     $this->assertEquals($item->getTags()->getCount(), 5);
 }
Exemplo n.º 2
0
 /**
  * Create a new user.
  *
  * Use his username as user CPR and aliasName
  *   (we will give the possibility to update it later).
  * Use user email as profile link.
  *
  * @TODO: Replace profile link with a real link to users profiles in
  * ding-system.
  */
 public function create($account)
 {
     $user_id = $this->createUser($account->name, $account->voxb['alias_name'], $account->mail);
     if ($user_id != 0) {
         $_SESSION['voxb']['userId'] = $user_id;
         $_SESSION['voxb']['aliasName'] = $account->voxb['alias_name'];
         // Fetch user actions and put serialized profile object into session.
         $profile = new VoxbProfile();
         $profile->setUserId($user_id);
         $profile->fetchMyData();
         $_SESSION['voxb']['profile'] = serialize($profile);
         return TRUE;
     }
     return FALSE;
 }
Exemplo n.º 3
0
 public function testUpdateReview()
 {
     $profile = new VoxbProfile();
     $profile->setUserId($this->users[0]);
     $profile->fetchMyData();
     $item = new VoxbItem();
     $item->addReviewHandler('review', new VoxbReviews());
     $item->fetchByFaust('111111111');
     $reviews = $item->getReviews('review');
     $reviewsNumBefore = $reviews->getCount();
     // Attempt to update a review
     $review = new VoxbReviewRecord();
     $r = $review->create('111111111', 'SecondReview', $profile);
     $this->assertTrue($r);
     $item = new VoxbItem();
     $item->addReviewHandler('review', new VoxbReviews());
     $item->fetchByFaust('111111111');
     $reviews = $item->getReviews('review');
     $reviewsNumAfter = $reviews->getCount();
     $reviews = $reviews->toArray();
     $this->assertEquals($reviewsNumBefore, $reviewsNumAfter);
     $this->assertEquals($reviews[0]['text'], 'SecondReview');
 }