LargeFileHelperTest.php 1.1 KB

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() {
  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. /**
  34. * @expectedException \UnexpectedValueException
  35. */
  36. public function testFormatUnsignedIntegerStringException() {
  37. $this->helper->formatUnsignedInteger('900ABCD254740993');
  38. }
  39. }