alecpl
2012-04-19 5d66a4bcf3ad5d584255184776f1f04451c929fc
tests/mailfunc.php
@@ -16,8 +16,7 @@
    $GLOBALS['RCMAIL'] = $RCMAIL = rcmail::get_instance();
    $GLOBALS['OUTPUT'] = $OUTPUT = $RCMAIL->load_gui();
    $RCMAIL->action = 'autocomplete';
    $RCMAIL->imap_init(false);
    $IMAP = $RCMAIL->imap;
    $RCMAIL->storage_init(false);
    
    require_once INSTALL_PATH . 'program/steps/mail/func.inc';
    
@@ -55,7 +54,6 @@
    //$this->assertNoPattern('/<style [^>]+>/', $html, "No style tags allowed");
    $this->assertNoPattern('/<form [^>]+>/', $html, "No form tags allowed");
    $this->assertPattern('/Subscription form/', $html, "Include <form> contents");
    $this->assertPattern('/<!-- input ignored -->/', $html, "No input elements allowed");
    $this->assertPattern('/<!-- link ignored -->/', $html, "No external links allowed");
    $this->assertPattern('/<a[^>]+ target="_blank">/', $html, "Set target to _blank");
    $this->assertTrue($GLOBALS['REMOTE_OBJECTS'], "Remote object detected");
@@ -93,10 +91,21 @@
  function test_html_xss2()
  {
    $part = $this->get_html_part('src/BID-26800.txt');
    $washed = rcmail_print_body($part, array('safe' => true));
    $washed = rcmail_html4inline(rcmail_print_body($part, array('safe' => true)), 'dabody', '', $attr, true);
    $this->assertNoPattern('/alert|expression|javascript|xss/', $washed, "Remove evil style blocks");
    $this->assertNoPattern('/font-style:italic/', $washed, "Allow valid styles");
  }
  /**
   * Test washtml class on non-unicode characters (#1487813)
   */
  function test_washtml_utf8()
  {
    $part = $this->get_html_part('src/invalidchars.html');
    $washed = rcmail_print_body($part);
    $this->assertPattern('/<p>символ<\/p>/', $washed, "Remove non-unicode characters from HTML message body");
  }
  /**
@@ -156,5 +165,9 @@
    $this->assertPattern('|src="http://alec\.pl/dir/img1\.gif"|', $html, "URI base resolving [1]");
    $this->assertPattern('|src="http://alec\.pl/dir/img2\.gif"|', $html, "URI base resolving [2]");
    $this->assertPattern('|src="http://alec\.pl/img3\.gif"|', $html, "URI base resolving [3]");
    // base resolving exceptions
    $this->assertPattern('|src="cid:theCID"|', $html, "URI base resolving exception [1]");
    $this->assertPattern('|src="http://other\.domain\.tld/img3\.gif"|', $html, "URI base resolving exception [2]");
  }
}