lithium\tests\cases\template\ViewTest::testEscapeOutputFilterWithInjectedEncoding PHP Method

testEscapeOutputFilterWithInjectedEncoding() public method

Tests that the output-escaping handler correctly inherits its encoding from the Response object, if provided.
    public function testEscapeOutputFilterWithInjectedEncoding()
    {
        $message = "Multibyte string support must be enabled to test character encodings.";
        $this->skipIf(!function_exists('mb_convert_encoding'), $message);
        $string = "Joël";
        $response = new Response();
        $response->encoding = 'UTF-8';
        $view = new View(compact('response'));
        $handler = $view->outputFilters['h'];
        $this->assertTrue(mb_check_encoding($handler($string), "UTF-8"));
        $response = new Response();
        $response->encoding = 'ISO-8859-1';
        $view = new View(compact('response'));
        $handler = $view->outputFilters['h'];
        $this->assertTrue(mb_check_encoding($handler($string), "ISO-8859-1"));
    }