You are here

function SizeUnitTest::testCommonFormatSize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Common/SizeUnitTest.php \Drupal\system\Tests\Common\SizeUnitTest::testCommonFormatSize()

Checks that format_size() returns the expected string.

File

core/modules/system/src/Tests/Common/SizeUnitTest.php, line 49
Contains \Drupal\system\Tests\Common\SizeUnitTest.

Class

SizeUnitTest
Parse a predefined amount of bytes and compare the output with the expected value.

Namespace

Drupal\system\Tests\Common

Code

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