FOSSology  4.4.0
Open Source License Compliance by Open Source Software
FileTest.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2020 Siemens AG
4  Author: Gaurav Mishra <mishra.gaurav@siemens.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
14 
18 
23 class FileTest extends \PHPUnit\Framework\TestCase
24 {
29  public function testDataFormat()
30  {
31  $expectedArray = [
32  "hash" => [
33  "sha1" => "sha1checksum",
34  "md5" => "md5checksum",
35  "sha256" => "sha256checksum",
36  "size" => 123
37  ],
38  "findings"=> [
39  "scanner" => [
40  "License1"
41  ],
42  "conclusion" => [
43  "License2"
44  ],
45  "copyright" => []
46  ],
47  "uploads" => []
48  ];
49 
50  $hash = new Hash('sha1checksum', 'md5checksum', 'sha256checksum', 123);
51  $findings = new Findings("License1", "License2", []);
52  $object = new File($hash);
53  $object->setFindings($findings);
54  $object->setUploads([]);
55 
56  $this->assertEquals($expectedArray, $object->getArray());
57  }
58 }
File model holding information about a single file.
Definition: File.php:19
Model holding information about license findings and conclusions.
Definition: Findings.php:18
Hash model holding information about file like checksums and size.
Definition: Hash.php:18