Ejemplo n.º 1
0
 /**
  * @depends test_newUser
  */
 public function test_getIPs($User)
 {
     $ips = $User->getIPs();
     $this->assertEquals(0, count($ips));
     $User->recordLogin("8.8.8.8");
     $ips = $User->getIPs();
     $this->assertEquals(1, count($ips));
     $Forums = new Forums();
     $Category = new Category();
     $Forum = new Forum();
     $Thread = new Thread();
     $Post = new Post();
     $Category->title = "Test category";
     $Category->commit();
     $Forum->name = "Test forum";
     $Forum->setCategory($Category)->commit();
     $Thread->title = "Test thread";
     $Thread->setForum($Forum)->setAuthor($User)->commit();
     $Post->ip = "8.8.8.8";
     $Post->text = "Test post text";
     $Post->setThread($Thread)->setAuthor($User)->commit();
     $ips = $User->getIPs();
     $this->assertEquals(2, count($ips));
 }
Ejemplo n.º 2
0
 /**
  * @depends testAddForum
  * @depends testCreateUser
  */
 public function testAddThread($forum_id, $User)
 {
     $Forum = ForumsFactory::CreateForum($forum_id);
     $Thread = new Thread();
     $Thread->setAuthor($User)->setForum($Forum);
     $Thread->title = "Test thread";
     $Thread->commit();
     $Post = new Post();
     $Post->setAuthor($User)->setThread($Thread);
     $Post->text = "asdfasffasasfa87s9fsas989sfa9ffds";
     $Post->commit();
     $NewThread = ForumsFactory::CreateThread($Thread->id);
     $NewPost = ForumsFactory::CreatePost($Post->id);
     $Index = ForumsFactory::CreateIndex();
     ForumsUtility::updateUserThreadView($Thread, $User);
     ForumsUtility::updateUserThreadView($Thread);
     ForumsUtility::getForumNotifications($User);
 }
Ejemplo n.º 3
0
 /**
  * @depends testAddIdea
  */
 public function test_createThread($idea_id)
 {
     $Idea = new Idea($idea_id);
     $Category = new ForumCategory();
     $Category->title = "Ideas";
     $Category->commit();
     $Forum = new Forum();
     $Forum->setCategory($Category);
     $Forum->name = "Ideas forum";
     $Forum->commit();
     $Thread = new Thread();
     $Thread->title = $Idea->title;
     $Thread->setForum($Forum)->setAuthor($Idea->Author)->commit();
     $Post = new Post();
     $Post->text = $Idea->description;
     $Post->ip = "8.8.8.8";
     $Post->setAuthor($Idea->Author)->setThread($Thread)->commit();
     $this->assertFalse(!filter_var($Post->id, FILTER_VALIDATE_INT));
     return $Thread->id;
 }
Ejemplo n.º 4
0
 /**
  * Set the discussion thread for this idea
  * @since Version 3.9.1
  * @param \Railpage\Forums\Thread $forumThread
  * @return \Railpage\Ideas\Idea
  */
 public function setForumThread(Thread $forumThread)
 {
     $this->forum_thread_id = $forumThread->id;
     $this->commit();
     $forumThread->putObject($this);
     return $this;
 }