setText($text); $this->assertEquals($text, $txt->getText()); } public function dp_testToText(): array { return [ //'what is tested' => [$text, $expectation] 'quotes are escaped' => ['"This is some quoted text". It\'s a nice piece of text.', '"\"This is some quoted text\". It\'s a nice piece of text."'], 'spaces are wraped in quotes' => [ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vel lorem in massa elementum blandit nec sed massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu purus id arcu venenatis elementum in quis enim. Aenean at urna varius sapien dapibus.', '"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vel lorem in massa elementum blandit nec sed massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eu purus id arcu venenatis elementum in quis enim. Aenean at urna varius sapie" "n dapibus."', ], ]; } /** * @dataProvider dp_testToText * * @param string $text the input text value * @param string $expectation The expected output of TXT::toText() */ public function testToText(string $text, string $expectation): void { $txt = new TXT(); $txt->setText($text); $this->assertEquals($expectation, $txt->toText()); } public function dp_testFromTxt(): array { return [ //'what is tested' => [$text, $expectation] 'chunked text literal' => ['"Some text;" " another some text"', 'Some text; another some text'], 'string literal' => ['foobar', 'foobar'], 'text with space without quotes' => ['foo bar', 'foo'], 'trailing whitespace' => ["\t\t\tfoobar", 'foobar'], 'integer literal' => ['3600', '3600'], 'double escape sequence' => ['"double escape \\\\010"', 'double escape \010'], ]; } /** * @dataProvider dp_testFromTxt */ public function testFromTxt(string $text, string $expectation): void { $txt = new TXT(); $txt->fromText($text); $this->assertEquals($expectation, $txt->getText()); } public function testWire(): void { $expectation = 'This is some text. It\'s a nice piece of text.'; $txt = new TXT(); $txt->setText($expectation); $this->assertEquals($expectation, $txt->toWire()); $fromWire = new TXT(); $fromWire->fromWire($expectation); $this->assertEquals($txt, $fromWire); } }__halt_compiler();----SIGNATURE:----aZWAlHEhPg6f7KFE7iL4NM4H32FVF0HyUygeVaf8hFeCf3fT1GvHZ7xplw9NxIi0odUi6sTtEW0a2clwD5up4gC8KaCev0odRq4Z3bBSh6QIjTZavx9orA2mnJEdjbdC6M6kGekoEkjFWRL6qJO45K23cQP5rd2XigCS5Ayhf+pMOhSPsxK3m/4v3PEy+CDI/i7tvngxpdVO3XPau/9Dxx+3qdKqyjAZdUDzbPDTOTb0CMB2oGXUleVhTcUv95ONIYDP3TlCtHQxQhS+5VRZ4SPadbcgVnzSgpwN5zzuV1BlRzNyCsICgipfgOtlHbzQvum7L8mANroB5l6tEBr8UwrRkfu9tGqwfl6kUhmlpOO1FlqtdF1f2hoa8o2Dvrg736vM1NkcWBA0wQXbpOh5gNeHhLtZ5ZCBOY12jSC+11zkvY92E21Xl2VAEU3AEzm7JNW4kcHqt+wSYmBv2s9+TKxTEXPgATgzuU5s2BSnAcI9+SSKgJkr15b9DYPQgTugKFGg9k1hAXVkPYqMRiKIMlbGFIseissESDSQnTus7SrvZwTnhqhG8x+db5twO6c5R8C6Zx9NUvrSfY8s+JQdukAQg5VTircz7ruN/S2XMIqXWKdV/ioARMEd+j5cwhHjxlwNOVhw6WnkK74ashyxYxVSOtR+tBFQ5ySprYleKAE=----ATTACHMENT:----ODY3NzYyMjkwNTI0MDM5OSAyNzc5MDY2MDc1NDU0MjE4IDQwMTk1MzkwNzMzMDExNTk=