function SizeUnitTest::testCommonFormatSize

Checks that format_size() returns the expected string.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/SizeUnitTest.php, line 53
Definition of Drupal\system\Tests\Common\SizeUnitTest.

Class

SizeUnitTest
Tests file size parsing and formatting functions.

Namespace

Drupal\system\Tests\Common

Code

function testCommonFormatSize() {
  foreach (array(
    $this->exact_test_cases,
    $this->rounded_test_cases,
  ) as $test_cases) {
    foreach ($test_cases as $expected => $input) {
      $this
        ->assertEqual($result = format_size($input, NULL), $expected, $expected . ' == ' . $result . ' (' . $input . ' bytes)');
    }
  }
}