Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

LargeFileHelperTest.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Andreas Fischer <bantu@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace Test;
  9. class LargeFileHelperTest extends TestCase {
  10. protected $helper;
  11. protected function setUp(): void {
  12. parent::setUp();
  13. $this->helper = new \OC\LargeFileHelper;
  14. }
  15. public function testFormatUnsignedIntegerFloat() {
  16. $this->assertSame(
  17. '9007199254740992',
  18. $this->helper->formatUnsignedInteger((float) 9007199254740992)
  19. );
  20. }
  21. public function testFormatUnsignedIntegerInt() {
  22. $this->assertSame(
  23. PHP_INT_SIZE === 4 ? '4294967295' : '18446744073709551615',
  24. $this->helper->formatUnsignedInteger(-1)
  25. );
  26. }
  27. public function testFormatUnsignedIntegerString() {
  28. $this->assertSame(
  29. '9007199254740993',
  30. $this->helper->formatUnsignedInteger('9007199254740993')
  31. );
  32. }
  33. public function testFormatUnsignedIntegerStringException() {
  34. $this->expectException(\UnexpectedValueException::class);
  35. $this->helper->formatUnsignedInteger('900ABCD254740993');
  36. }
  37. }