escape($stringToEscape); $this->assertEquals($expectedEscapedString, $escapedString, 'Incorrect escaped string'); } /** * @return array */ public function dataProviderForTestUnescape() { return [ ['test', 'test'], ['adam's "car"', 'adam\'s "car"'], ['_x0000_', chr(0)], ['_x005F_x0000_', '_x0000_'], ['_x0015_', chr(21)], ['control _x0015_ character', 'control '.chr(21).' character'], ['control's _x0015_ "character"', 'control\'s '.chr(21).' "character"'], ]; } /** * @dataProvider dataProviderForTestUnescape * * @param string $stringToUnescape * @param string $expectedUnescapedString * @return void */ public function testUnescape($stringToUnescape, $expectedUnescapedString) { /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ $escaper = \Box\Spout\Common\Escaper\XLSX::getInstance(); $unescapedString = $escaper->unescape($stringToUnescape); $this->assertEquals($expectedUnescapedString, $unescapedString, 'Incorrect escaped string'); } }