17 use PHPUnit\Framework\TestCase;
26 private $filePath =
"/path/to/file.txt";
28 private $clearingStatus =
"identified";
33 protected function setUp(): void
36 $this->findings = $this->createMock(Findings::class);
37 $this->findings->method(
'getArray')->willReturn([
'mock' =>
'findings']);
49 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
50 $this->assertInstanceOf(FileLicenses::class, $fileLicenses);
61 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
62 $this->assertEquals($this->filePath, $fileLicenses->getFilePath());
71 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
72 $this->assertEquals($this->findings, $fileLicenses->getFindings());
81 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
82 $this->assertEquals($this->clearingStatus, $fileLicenses->getClearingStatus());
93 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
94 $newPath =
"/new/path/file.php";
95 $fileLicenses->setFilePath($newPath);
96 $this->assertEquals($newPath, $fileLicenses->getFilePath());
105 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
106 $newFindings = $this->createMock(Findings::class);
107 $fileLicenses->setFindings($newFindings);
108 $this->assertEquals($newFindings, $fileLicenses->getFindings());
117 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
118 $newStatus =
"cleared";
119 $fileLicenses->setClearingStatus($newStatus);
120 $this->assertEquals($newStatus, $fileLicenses->getClearingStatus());
129 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
131 $fileLicenses->setFilePath(
null);
132 $this->assertNull($fileLicenses->getFilePath());
134 $fileLicenses->setFindings(
null);
135 $this->assertNull($fileLicenses->getFindings());
137 $fileLicenses->setClearingStatus(
null);
138 $this->assertNull($fileLicenses->getClearingStatus());
149 $result = $fileLicenses->setFilePath($this->filePath)
150 ->setFindings($this->findings)
151 ->setClearingStatus($this->clearingStatus);
153 $this->assertInstanceOf(FileLicenses::class, $result);
154 $this->assertEquals($this->filePath, $fileLicenses->getFilePath());
155 $this->assertEquals($this->findings, $fileLicenses->getFindings());
156 $this->assertEquals($this->clearingStatus, $fileLicenses->getClearingStatus());
165 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
168 'filePath' => $this->filePath,
169 'findings' => [
'mock' =>
'findings'],
170 'clearing_status' => $this->clearingStatus
173 $this->assertEquals($expectedArray, $fileLicenses->getArray(ApiVersion::V1));
182 $fileLicenses =
new FileLicenses($this->filePath, $this->findings, $this->clearingStatus);
185 'filePath' => $this->filePath,
186 'findings' => [
'mock' =>
'findings'],
187 'clearingStatus' => $this->clearingStatus
190 $this->assertEquals($expectedArray, $fileLicenses->getArray(ApiVersion::V2));
Model holding information about license findings and conclusions.
Tests for FileLicenses model.
testSettersWithNullValues()
testSetterMethodChaining()