From ffe876d931c43f1c7149393bf0670697c2bdbe7f Mon Sep 17 00:00:00 2001 From: Aistis Date: Thu, 19 Jun 2025 12:00:11 +0300 Subject: [PATCH] Add test for inserting binary data --- tests/ClientTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/ClientTest.php b/tests/ClientTest.php index d0a5e52c..ee0338dc 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -59,6 +59,22 @@ public function testPutGetInteger() $this->assertIsInt($binGet["integerBin"]); } + public function testPutGetBinary() + { + $binary = "\x41\x42\xFF\x43\x00\x7F\x80\xE2\x98\x85"; + $binBinary = new Bin("binaryBin", $binary); + $newKey = new Key(self::$namespace, self::$set, 4); + $wp = new WritePolicy(); + self::$client->put($wp, $newKey, [$binBinary]); + + $rp = new ReadPolicy(); + $record = self::$client->get($rp, $newKey, ["binaryBin"]); + $binGet = $record->getBins(); + + $this->assertIsString($binGet["binaryBin"]); + $this->assertSame($binary, $binGet["binaryBin"]); + } + public function testPutGetLists() { // Prepare a list (array) bin