FrameTest.php 454 B

1234567891011121314151617181920
  1. <?php
  2. use Workerman\Protocols\Frame;
  3. it('tests ::input', function () {
  4. expect(Frame::input('foo'))->toBe(0)
  5. ->and(Frame::input("\0\0\0*foobar"))
  6. ->toBe(42);
  7. });
  8. it('tests ::decode', function () {
  9. $buffer = pack('N', 5) . 'jhdxr';
  10. expect(Frame::decode($buffer))
  11. ->toBe('jhdxr');
  12. });
  13. it('tests ::encode', function () {
  14. expect(Frame::encode('jhdxr'))
  15. ->toBe(pack('N', 9) . 'jhdxr');
  16. });