FOSSology  4.4.0
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  print('.');
26  }
27 
31  protected function tearDown() : void
32  {
33  print "Ending unit test for common-ui.php\n";
34  }
35 
39  function test_HumanSize()
40  {
41  print "test function HumanSize()\n";
42  $result = HumanSize(1024 * 1024 * 1024);
43  $this->assertEquals("1 GB", $result);
44  $result = HumanSize(10240);
45  $this->assertEquals("10 KB", $result);
46  $result = HumanSize(1024 * (1024 * 99 + 511));
47  $this->assertEquals("99.5 MB", $result);
48  }
49 }
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