Phalcon\Test\Unit\EscaperTest::testDetectEncoding PHP Метод

testDetectEncoding() публичный Метод

Tests the detectEncoding
С версии: 2014-09-16
Автор: Nikolaos Dimopoulos ([email protected])
public testDetectEncoding ( )
    public function testDetectEncoding()
    {
        $this->specify('The escaper does not detect the encoding correctly UTF-8', function () {
            $escaper = new Escaper();
            expect($escaper->detectEncoding('ḂḃĊċḊḋḞḟĠġṀṁ'))->equals('UTF-8');
        });
        $this->specify('The escaper does not detect the encoding correctly ISO-8859-1', function () {
            $escaper = new Escaper();
            expect($escaper->detectEncoding(chr(172) . chr(128) . chr(159) . 'ḂḃĊċḊḋḞḟĠġṀṁ'))->equals('ISO-8859-1');
        });
        $this->specify('The escaper does not detect the encoding correctly UTF-8', function () {
            $escaper = new Escaper();
            expect($escaper->detectEncoding('\\0\\0\\0H\\0\\0\\0i'))->equals('UTF-8');
        });
    }