From 4eaebd48aa6626026ecb09a079f938651a4a7187 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Fri, 18 May 2018 12:03:27 +0800 Subject: [PATCH] Add test for issue 71 --- test/unit/EthabiTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/unit/EthabiTest.php b/test/unit/EthabiTest.php index 2d900ce3..321350af 100644 --- a/test/unit/EthabiTest.php +++ b/test/unit/EthabiTest.php @@ -293,4 +293,23 @@ public function testDecodeParameters() } } } + + /** + * testIssue71 + * test 33 bytes and 128 bytes string, see: https://github.com/sc0Vu/web3.php/issues/71 + * string generated from: https://www.lipsum.com/ + * + * @return void + */ + public function testIssue71() + { + $abi = $this->abi; + $specialString = 'Lorem ipsum dolor sit amet metus.'; + $encodedString = $abi->encodeParameter('string', $specialString); + $this->assertEquals($specialString, $abi->decodeParameter('string', $encodedString)); + + $specialString = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce pulvinar quam felis, suscipit posuere neque aliquam in cras amet.'; + $encodedString = $abi->encodeParameter('string', $specialString); + $this->assertEquals($specialString, $abi->decodeParameter('string', $encodedString)); + } } \ No newline at end of file