/** * @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; }
/** * @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)); }
/** * @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); }