[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> common_php_to_byte.test.php (source)

   1  <?php
   2  
   3  class common_php_to_byte_test extends DokuWikiTest {
   4  
   5  
   6      public function data() {
   7          $data = [
   8              ['1G', 1073741824],
   9              ['8M', 8388608],
  10              ['8K', 8192],
  11              ['800', 800],
  12              ['8', 8],
  13              ['0', 0],
  14              ['-1', -1]
  15          ];
  16  
  17          // larger sizes only work on 64bit platforms
  18          if(PHP_INT_SIZE == 8) {
  19              $data[] = ['8G', 8589934592];
  20          }
  21  
  22          return $data;
  23      }
  24  
  25      /**
  26       * @dataProvider data
  27       * @param string $value
  28       * @param int $bytes
  29       */
  30      public function test_undefined($value, $bytes) {
  31          $this->assertSame($bytes, php_to_byte($value));
  32      }
  33  
  34  }