VerifyStreamTest.php 751 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace AlibabaCloud\Tea\OSSUtils\Tests;
  3. use AlibabaCloud\Tea\OSSUtils\VerifyStream;
  4. use PHPUnit\Framework\TestCase;
  5. /**
  6. * Class VerifyStreamTest.
  7. *
  8. * @internal
  9. * @coversNothing
  10. */
  11. class VerifyStreamTest extends TestCase
  12. {
  13. public function testVerifyStream()
  14. {
  15. $stream = fopen('data://text/plain;base64,' . base64_encode('test'), 'r+');
  16. $verifyStream = new VerifyStream($stream);
  17. $verifyStream->read(1);
  18. $verifyStream->read(1);
  19. $verifyStream->read(1);
  20. $verifyStream->read(1);
  21. $verify = $verifyStream->getVerify();
  22. $this->assertEquals('CY9rzUYh03PK3k6DJie09g==', $verify['md5']);
  23. $this->assertEquals('18020588380933092773', $verify['crc']);
  24. }
  25. }