lithium\tests\cases\template\view\RendererTest::testHandlerQuerying PHP Method

testHandlerQuerying() public method

public testHandlerQuerying ( )
    public function testHandlerQuerying()
    {
        $result = $this->subject->nonExistent('test value');
        $expected = 'test value';
        $this->assertEqual($expected, $result);
        $result = $this->subject->applyHandler(null, null, 'nonExistent', 'test value');
        $this->assertEqual($expected, $result);
        $html = new Html();
        $script = '<script>alert("XSS!");</script>';
        $escaped = '&lt;script&gt;alert(&quot;XSS!&quot;);&lt;/script&gt;';
        $result = $this->subject->applyHandler($html, null, 'title', $script);
        $expected = $escaped;
        $this->assertEqual($expected, $result);
        $result = $this->subject->applyHandler($html, null, 'foo', $script);
        $expected = $script;
        $this->assertEqual($expected, $result);
        $result = $this->subject->applyHandler($html, null, 'bar', $script);
        $this->assertEqual($expected, $result);
        $this->subject->handlers(array('foo' => array($html, 'escape'), 'bar' => 42));
        $result = $this->subject->applyHandler($html, null, 'bar', $script);
        $this->assertEqual($expected, $result);
        $result = $this->subject->applyHandler($html, null, 'foo', $script);
        $expected = $escaped;
        $this->assertEqual($expected, $result);
    }