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