FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ScanCodeTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2024 Valens Niyonsenga <valensniyonsenga2003@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
12 
14 use Monolog\Test\TestCase;
15 
16 class ScanCodeTest extends TestCase
17 {
25  private function getScanCodeInfo()
26  {
27  $expectedArray = [
28  "license" => false,
29  "copyright" => false,
30  "email" => false,
31  "url" => false
32  ];
33  $obj = new Scancode();
34  return [
35  'expectedArray' => $expectedArray,
36  'obj' => $obj
37  ];
38  }
39 
45  public function testDataFormat()
46  {
47  $expectedArray = $this->getScanCodeInfo()['expectedArray'];
48  $scanCode = $this->getScanCodeInfo()['obj'];
49  $this->assertEquals($expectedArray, $scanCode->getArray());
50  }
51 
58  public function testSetAndGetLicense()
59  {
60  $info = $this->getScanCodeInfo();
61  $obj = $info['obj'];
62  $obj->setScanLicense(true);
63  $this->assertTrue($obj->getScanLicense());
64  }
65 
72  public function testSetAndGetCopyright()
73  {
74  $info = $this->getScanCodeInfo();
75  $obj = $info['obj'];
76  $obj->setScanCopyright(true);
77  $this->assertTrue($obj->getScanCopyright());
78  }
79 
86  public function testSetAndGetEmail()
87  {
88  $info = $this->getScanCodeInfo();
89  $obj = $info['obj'];
90  $obj->setScanEmail(true);
91  $this->assertTrue($obj->getScanEmail());
92  }
93 
100  public function testSetAndGetUrl()
101  {
102  $info = $this->getScanCodeInfo();
103  $obj = $info['obj'];
104  $obj->setScanUrl(true);
105  $this->assertTrue($obj->getScanUrl());
106  }
107 }