FOSSology  4.4.0
Open Source License Compliance by Open Source Software
LicenseRefTest.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: Andreas Würl
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\Lib\Data;
10 
11 class LicenseRefTest extends \PHPUnit\Framework\TestCase
12 {
13  private $id = 321;
14  private $shortName = "<shortName>";
15  private $fullName = "<fullName>";
16  private $spdxId = "<spdxId>";
17 
21  private $licenseRef;
22 
23  protected function setUp() : void
24  {
25  $this->licenseRef = new LicenseRef($this->id, $this->shortName, $this->fullName, $this->spdxId);
26  }
27 
28  public function testGetId()
29  {
30  assertThat($this->licenseRef->getId(), is($this->id));
31  }
32 
33  public function testGetShortName()
34  {
35  assertThat($this->licenseRef->getShortName(), is($this->shortName));
36  }
37 
38  public function testGetFullName()
39  {
40  assertThat($this->licenseRef->getFullName(), is($this->fullName));
41  }
42 
43  public function testGetSpdxId()
44  {
45  assertThat($this->licenseRef->getSpdxId(), is($this->spdxId));
46  }
47 
48  public function testDefaultSpdxId()
49  {
50  $licenseRef = new LicenseRef($this->id, $this->shortName, $this->fullName, "");
51  assertThat($licenseRef->getSpdxId(), is(LicenseRef::SPDXREF_PREFIX_FOSSOLOGY . $this->shortName));
52  }
53 }