We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c856ad commit 67a82c0Copy full SHA for 67a82c0
tests/phpunit/BinaryTest.php
@@ -36,4 +36,19 @@ public function testReadSignedByteWithEmptyString() : void{
36
$this->expectException(BinaryDataException::class);
37
Binary::readSignedByte("");
38
}
39
+
40
+ /**
41
+ * Passing too much data is OK; we just take the first N bytes as needed.
42
+ */
43
+ public function testReadShortTooMuchData() : void{
44
+ $expected = 19132;
45
+ $data = Binary::writeShort($expected) . "\x00\x00";
46
+ $number = Binary::readShort($data);
47
+ self::assertSame($expected, $number);
48
+ }
49
50
+ public function testReadShortNotEnoughData() : void{
51
+ $this->expectException(BinaryDataException::class);
52
+ Binary::readShort("\x01");
53
54
0 commit comments