3 namespace PhpParser\Node\Scalar;
5 class StringTest extends \PHPUnit_Framework_TestCase
8 * @dataProvider provideTestParseEscapeSequences
10 public function testParseEscapeSequences($expected, $string, $quote) {
13 String_::parseEscapeSequences($string, $quote)
18 * @dataProvider provideTestParse
20 public function testCreate($expected, $string) {
23 String_::parse($string)
27 public function provideTestParseEscapeSequences() {
29 array('"', '\\"', '"'),
30 array('\\"', '\\"', '`'),
31 array('\\"\\`', '\\"\\`', null),
32 array("\\\$\n\r\t\f\v", '\\\\\$\n\r\t\f\v', null),
33 array("\x1B", '\e', null),
34 array(chr(255), '\xFF', null),
35 array(chr(255), '\377', null),
36 array(chr(0), '\400', null),
37 array("\0", '\0', null),
38 array('\xFF', '\\\\xFF', null),
42 public function provideTestParse() {
48 array('\\', '\'\\\\\''),
49 array('\'', '\'\\\'\''),
52 foreach ($this->provideTestParseEscapeSequences() as $i => $test) {
53 // skip second and third tests, they aren't for double quotes
54 if ($i != 1 && $i != 2) {
55 $tests[] = array($test[0], '"' . $test[1] . '"');