1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-10 23:34:00 +02:00

html encode and decode

This commit is contained in:
Jarrett Croll
2015-06-16 12:27:20 -04:00
parent f1009d0267
commit f9729788c4
6 changed files with 146 additions and 0 deletions

View File

@@ -911,4 +911,28 @@ class StringyTestCase extends CommonTest
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
/**
* @dataProvider htmlEncodeProvider()
*/
public function testHtmlEncode($expected, $str, $flags = ENT_COMPAT, $encoding = null)
{
$stringy = S::create($str, $encoding);
$result = $stringy->htmlEncode($flags);
$this->assertStringy($result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
/**
* @dataProvider htmlDecodeProvider()
*/
public function testHtmlDecode($expected, $str, $flags = ENT_COMPAT, $encoding = null)
{
$stringy = S::create($str, $encoding);
$result = $stringy->htmlDecode($flags);
$this->assertStringy($result);
$this->assertEquals($expected, $result);
$this->assertEquals($str, $stringy);
}
}