16 use PHPUnit\Framework\TestCase;
30 protected function setUp(): void
33 "ri_reviewed" =>
true,
34 "ri_footer" =>
"Test Footer",
35 "ri_report_rel" =>
"1.0.0",
36 "ri_community" =>
"Test Community",
37 "ri_component" =>
"Test Component",
38 "ri_version" =>
"1.0",
39 "ri_release_date" =>
"2025-02-15",
40 "ri_sw360_link" =>
"https://example.com",
41 "ri_component_type" => 1,
42 "ri_component_id" =>
"TEST-123",
43 "ri_general_assesment" =>
"Test Assessment",
44 "ri_ga_additional" =>
"Additional Notes",
45 "ri_ga_risk" =>
"Low",
46 "ri_ga_checkbox_selection" =>
"Option 1",
47 "ri_spdx_selection" =>
"MIT",
48 "ri_excluded_obligations" => json_encode([
"obligation1",
"obligation2"]),
49 "ri_department" =>
"Test Department",
50 "ri_depnotes" =>
"Department Notes",
51 "ri_exportnotes" =>
"Export Notes",
52 "ri_copyrightnotes" =>
"Copyright Notes",
53 "ri_unifiedcolumns" => json_encode([
"col1",
"col2"]),
54 "ri_globaldecision" => 1
68 $this->assertInstanceOf(Conf::class, $conf);
77 $conf =
new Conf($this->sampleData);
78 $result = $conf->getArray();
80 $this->assertIsArray($result);
81 $this->assertEquals(
true, $result[
'reviewed']);
82 $this->assertEquals(
"Test Footer", $result[
'footer']);
83 $this->assertEquals(
"1.0.0", $result[
'reportRel']);
84 $this->assertEquals(
"Test Community", $result[
'community']);
85 $this->assertEquals(
"Test Component", $result[
'component']);
86 $this->assertEquals(
"1.0", $result[
'version']);
87 $this->assertEquals(
"2025-02-15", $result[
'releaseDate']);
88 $this->assertEquals(
"https://example.com", $result[
'sw360Link']);
90 $this->assertEquals(
"TEST-123", $result[
'componentId']);
91 $this->assertEquals(
"Test Assessment", $result[
'generalAssesment']);
92 $this->assertEquals(
"Additional Notes", $result[
'gaAdditional']);
93 $this->assertEquals(
"Low", $result[
'gaRisk']);
94 $this->assertEquals(
"Option 1", $result[
'gaCheckbox']);
95 $this->assertEquals(
"MIT", $result[
'spdxSelection']);
96 $this->assertEquals([
"obligation1",
"obligation2"], $result[
'excludedObligations']);
97 $this->assertEquals(
"Test Department", $result[
'department']);
98 $this->assertEquals(
"Department Notes", $result[
'depNotes']);
99 $this->assertEquals(
"Export Notes", $result[
'exportNotes']);
100 $this->assertEquals(
"Copyright Notes", $result[
'copyrightNotes']);
101 $this->assertEquals([
"col1",
"col2"], $result[
'unifiedColumns']);
102 $this->assertEquals(
true, $result[
'globalDecision']);
111 $conf =
new Conf($this->sampleData);
112 $result = $conf->getJSON();
114 $this->assertIsString($result);
115 $this->assertJson($result);
117 $decodedJson = json_decode($result,
true);
118 $this->assertEquals($conf->getArray(), $decodedJson);
129 $this->assertEquals(
"ri_reviewed", $conf->getKeyColumnName(
"reviewed"));
130 $this->assertEquals(
"ri_footer", $conf->getKeyColumnName(
"footer"));
131 $this->assertEquals(
"ri_component_type", $conf->getKeyColumnName(
"componentType"));
132 $this->assertEquals(
"ri_globaldecision", $conf->getKeyColumnName(
"globalDecision"));
143 $this->assertTrue($conf->doesKeyExist(
"reviewed"));
144 $this->assertTrue($conf->doesKeyExist(
"footer"));
145 $this->assertTrue($conf->doesKeyExist(
"componentType"));
146 $this->assertTrue($conf->doesKeyExist(
"globalDecision"));
157 $this->assertFalse($conf->doesKeyExist(
"invalidKey"));
158 $this->assertFalse($conf->doesKeyExist(
""));
159 $this->assertFalse($conf->doesKeyExist(
"123"));
Conf model to contain general error and return values.
testDoesKeyExistValidKeys()
testDoesKeyExistInvalidKeys()