FOSSology  4.7.1
Open Source License Compliance by Open Source Software
test_common_ui.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: Steffen Weber
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
14 require_once(dirname(__FILE__) . '/../common-ui.php');
15 
19 class test_common_ui extends \PHPUnit\Framework\TestCase
20 {
21  /* initialization */
22  protected function setUp() : void
23  {
24  //print "Starting unit test for common-ui.php\n";
25  }
26 
30  protected function tearDown() : void
31  {
32  }
33 
37  function test_HumanSize()
38  {
39  $result = HumanSize(1024 * 1024 * 1024);
40  $this->assertEquals("1 GB", $result);
41  $result = HumanSize(10240);
42  $this->assertEquals("10 KB", $result);
43  $result = HumanSize(1024 * (1024 * 99 + 511));
44  $this->assertEquals("99.5 MB", $result);
45  }
46 }
tearDown()
clean the env
test_HumanSize()
test for HumanSize
HumanSize( $bytes)
Translate a byte number to a proper type, xxx bytes to xxx B/KB/MB/GB/TB/PB.
Definition: common-ui.php:100