Exemple #1
0
 /**
  * Tests adding a new comment, testing HTML cleaning.
  */
 public function testHTMLCleaningAddComment()
 {
     global $THEUSER;
     $THEUSER = new THEUSER();
     $THEUSER->init(1);
     $comment = new COMMENT();
     $data = array('epobject_id' => 1, 'body' => "This is a test comment, including http://theyworkforyou.com <a href=\"http://theyworkforyou.com\">links</a>, <b>bold</b>, <i>italics</i>, and stray < brackets to ensure they're not stripped.\n\nIt also includes <script>alert('malicious!');</script> script tags, to ensure they are stripped correctly.\n\nIt also spans multiple lines.", 'gid' => '');
     $commentId = $comment->create($data);
     // A correctly inserted comment returns an integer
     $this->assertInternalType('integer', $commentId);
     $comment = new COMMENT($commentId);
     $this->assertEquals("This is a test comment, including http://theyworkforyou.com <a href=\"http://theyworkforyou.com\">links</a>, <b>bold</b>, <i>italics</i>, and stray &lt; brackets to ensure they're not stripped.\n\nIt also includes alert('malicious!'); script tags, to ensure they are stripped correctly.\n\nIt also spans multiple lines.", $comment->body());
 }
Exemple #2
0
 public function testExpiredToken()
 {
     $_COOKIE['epuser_id'] = '1.5ce7f6e2d7de4db00c297e1da0d48ac';
     $u = new THEUSER();
     $u->loggedin = 1;
     $this->assertEquals('*****@*****.**', $u->email(), 'confirming inital email address');
     $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::user@example.net"');
     $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens');
     $token = '2-lkdsjafhsadjhf';
     $u->confirm_email($token, false);
     $this->assertEquals('*****@*****.**', $u->email(), 'expired token does not update email address');
     $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::user@example.net"');
     $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens');
 }