Beispiel #1
0
 /**
  * @dataProvider  escapeHtmlProvider()
  */
 public function testEscapeHtml($text, $full_encode, $double_encode, $expected)
 {
     $this->assertSame($expected, String::escapeHTML($text, $full_encode, $double_encode), 'Escaping using function');
     if (!$double_encode) {
         // we can't force double-encoding off for the generic escape() method
         // as it's usually the sensible behaviour.
         return;
     }
     $ctx = RenderContext::create(RenderContext::TYPE_HTML4_STRICT);
     RenderContext::push($ctx);
     $this->assertSame($expected, String::escape($text, null, $full_encode), 'Escaping using HTML RenderContext');
     $ctx = RenderContext::create(RenderContext::TYPE_XHTML1_STRICT);
     RenderContext::push($ctx);
     $this->assertSame($expected, String::escape($text, null, $full_encode), 'Escaping using XHTML RenderContext');
     RenderContext::pop();
     RenderContext::pop();
     $this->assertSame($expected, String::escape($text, RenderContext::CONTENT_HTML, $full_encode), 'Escaping using HTML content override');
     $this->assertSame($expected, String::escape($text, RenderContext::CONTENT_XHTML, $full_encode), 'Escaping using XHTML content override');
 }
Beispiel #2
0
 /**
  *
  */
 public function setUp()
 {
     Template::setPath(DATA_DIR . 'templates');
     RenderContext::set(RenderContext::create(RenderContext::TYPE_HTML4_STRICT));
 }
Beispiel #3
0
 /**
  * @expectedException PHPUnit_Framework_Error
  */
 public function testSetXHTMLCompatModeError()
 {
     $ctx = RenderContext::create(RenderContext::TYPE_HTML4_STRICT);
     $ctx->setXHTMLCompatMode(true);
 }
Beispiel #4
0
 /**
  *
  */
 public function setUp()
 {
     RenderContext::set(RenderContext::create(RenderContext::TYPE_HTML4_STRICT));
 }
Beispiel #5
0
 */
# Don't include Jerity more than once:
if (defined('JERITY_ROOT_PATH')) {
    trigger_error('Jerity should not be included more than once.', E_USER_WARNING);
    return;
}
# Set some constants:
/**
 *
 */
define('JERITY_ROOT_PATH', rtrim(__DIR__, '/'));
/**
 *
 */
define('JERITY_PHP_VERSION', '5.3');
# Check PHP version:
if (version_compare(PHP_VERSION, JERITY_PHP_VERSION, '<')) {
    trigger_error('Jerity requires PHP ' . JERITY_PHP_VERSION . ' or later.', E_USER_ERROR);
}
# Enable full error reporting (including strict standards and deprecated):
$_er_ = error_reporting(E_ALL | E_STRICT | E_DEPRECATED);
# Include the core utility class:
require_once JERITY_ROOT_PATH . '/Base.php';
# Add root folder as an autoload directory:
\Jerity\Base::addAutoloadDir(JERITY_ROOT_PATH);
# Set default global render context to HTML 4.01 Strict:
\Jerity\Core\RenderContext::set(\Jerity\Core\RenderContext::create(\Jerity\Core\RenderContext::TYPE_HTML4_STRICT));
# Restore original error reporting:
error_reporting($_er_);
unset($_er_);
# vim:et:ts=2:sts=2:sw=2:nowrap:ft=php:fdm=marker