FOSSology  4.7.1
Open Source License Compliance by Open Source Software
test_common_dir.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2011 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
13 require_once(dirname(__FILE__) . '/../common-dir.php');
14 
18 class test_common_dir extends \PHPUnit\Framework\TestCase
19 {
20  /* initialization */
21  protected function setUp() : void
22  {
23  // print "Starting unit test for common-dir.php\n";
24  }
25 
29  protected function tearDown() : void
30  {
31  //print "Ending unit test for common-dir.php\n";
32  }
33 
37  function test_Is()
38  {
39  $mode = 536888320;
40  $result = Isdir($mode);
41  $this->assertEquals(true, $result);
42  $mode = 33188;
43  $result = Isdir($mode);
44  $this->assertEquals(false, $result);
45  $mode = 536888320;
46  $result = Isartifact($mode);
47  $this->assertEquals(false, $result);
48  $mode = 805323776;
49  $result = Isartifact($mode);
50  $this->assertEquals(true, $result);
51  $mode = 536888320;
52  $result = Iscontainer($mode);
53  $this->assertEquals(true, $result);
54  $mode = 805323776;
55  $result = Iscontainer($mode);
56  $this->assertEquals(true, $result);
57 
58  $result = DirMode2String($mode);
59  $this->assertEquals("a-d-----S---", $result);
60  //print "Ending unit test for common-dir.php\n";
61  }
65  public function test_GetFileExt()
66  {
67  $this->assertEquals(GetFileExt('autodestroy.exe.bak'),'bak');
68  }
69 
73  public function test_DirMode2String()
74  {
75  // print "test function DirMode2String()\n";
76  $result = DirMode2String(805323776);
77  $this->assertEquals("a-d-----S---", $result);
78  $result = DirMode2String(0644);
79  $this->assertEquals("---rw-r--r--", $result);
80  }
81 }
test_GetFileExt()
test of ExtensionGetter
test_DirMode2String()
test for DirMode2String
tearDown()
clean the env
test_Is()
test for Isdir Isartifact Iscontainer
Isdir($mode)
Definition: common-dir.php:20
Isartifact($mode)
Definition: common-dir.php:29
DirMode2String($Mode)
Convert a file mode to string values.
Definition: common-dir.php:50
Iscontainer($mode)
Definition: common-dir.php:38
GetFileExt($fname)
Get File Extension (text after last period)
Definition: common-ui.php:142