Esempio n. 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());
 }