36 protected function setUp()
39 $this->
dbManager = $this->testDb->getDbManager();
40 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
43 protected function tearDown()
49 public function testGetFileLicenseMatches()
51 $this->testDb->createPlainTables(array(
'license_ref',
'uploadtree',
'license_file',
'agent'));
52 $this->testDb->insertData_license_ref();
54 $lic0 = $this->
dbManager->getSingleRow(
"Select * from license_ref limit 1");
55 $licenseRefNumber = $lic0[
'rf_pk'];
66 $mydate =
"'2014-06-04 14:01:30.551093+02'";
67 $this->testDb->createViews(array(
'license_file_ref'));
68 $this->
dbManager->queryOnce(
"INSERT INTO license_file (fl_pk, rf_fk, agent_fk, rf_match_pct, rf_timestamp, pfile_fk) 69 VALUES ($licenseFileId, $licenseRefNumber, $agentId, $matchPercent, $mydate, $pfileId)");
70 $this->
dbManager->queryOnce(
"INSERT INTO uploadtree (uploadtree_pk, upload_fk, pfile_fk, lft, rgt) 71 VALUES ($uploadtreeId, $uploadID, $pfileId, $left, $right)");
72 $stmt = __METHOD__.
'.insert.agent';
73 $this->
dbManager->prepare($stmt,
"INSERT INTO agent (agent_pk, agent_name, agent_rev, agent_enabled) VALUES ($1,$2,$3,$4)");
74 $this->
dbManager->execute($stmt,array($agentId, $agentName, $agentRev,
'true'));
77 $itemTreeBounds =
new ItemTreeBounds($uploadtreeId,
"uploadtree",$uploadID,$left,$right);
78 $matches = $licDao->getAgentFileLicenseMatches($itemTreeBounds);
80 $licenseRef =
new LicenseRef($licenseRefNumber, $lic0[
'rf_shortname'], $lic0[
'rf_fullname']);
81 $agentRef =
new AgentRef($agentId, $agentName, $agentRev);
82 $expected = array(
new LicenseMatch($pfileId, $licenseRef, $agentRef, $licenseFileId, $matchPercent) );
84 assertThat($matches, equalTo($expected));
85 assertThat($matches[0], is(anInstanceOf(LicenseMatch::class)) );
86 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
90 public function testGetLicenseByShortName()
92 $this->testDb->createPlainTables(array(
'license_ref'));
93 $this->testDb->insertData_license_ref($limit=3);
95 $lic0 = $this->
dbManager->getSingleRow(
"Select rf_shortname from license_ref limit 1");
96 $sname = $lic0[
'rf_shortname'];
97 $lic = $licDao->getLicenseByShortName($sname);
98 $this->assertInstanceOf(
'Fossology\Lib\Data\License', $lic);
99 $this->assertEquals($sname, $lic->getShortName());
101 $sname =
"Self-destructing license";
102 $lic = $licDao->getLicenseByShortName($sname);
103 $this->assertNull($lic);
106 public function testGetLicenseId()
108 $this->testDb->createPlainTables(array(
'license_ref'));
109 $this->testDb->insertData_license_ref($limit=3);
111 $lic0 = $this->
dbManager->getSingleRow(
"Select rf_pk from license_ref limit 1");
112 $id = $lic0[
'rf_pk'];
113 $lic = $licDao->getLicenseById($id);
114 $this->assertInstanceOf(
'Fossology\Lib\Data\License', $lic);
115 $this->assertEquals($id, $lic->getId());
118 $lic = $licDao->getLicenseById($invalidId);
119 $this->assertNull($lic);
122 public function testGetLicenseRefs()
124 $this->testDb->createPlainTables(array(
'license_ref'));
125 $this->testDb->insertData_license_ref();
127 $licAll = $licDao->getLicenseRefs();
128 $cntA = $this->
dbManager->getSingleRow(
"Select count(*) cnt from license_ref limit 1");
129 $this->assertEquals($cntA[
'cnt'], count($licAll));
130 $this->assertInstanceOf(
'Fossology\Lib\Data\LicenseRef', $licAll[0]);
133 public function testGetLicenseShortnamesContained()
135 $this->testDb->createPlainTables(array(
'license_ref',
'license_file',
'uploadtree'));
136 $this->
dbManager->queryOnce(
"CREATE TABLE \"uploadtree_a\" AS SELECT * FROM uploadtree");
137 $this->testDb->createViews(array(
'license_file_ref'));
138 $this->testDb->insertData(array(
'license_file',
'uploadtree_a'));
139 $this->testDb->insertData_license_ref($limit=3);
140 $stmt = __METHOD__.
'.select.license_ref';
141 $this->
dbManager->prepare($stmt,
"SELECT rf_pk,rf_shortname FROM license_ref");
142 $licRes = $this->
dbManager->execute($stmt);
144 while ($erg=$this->
dbManager->fetchArray($licRes)) {
145 $licAll[$erg[
'rf_pk']] = $erg[
'rf_shortname'];
155 $mydate =
"'2014-06-04 14:01:30.551093+02'";
156 foreach ($licAll as $licenseRefNumber=>$shortname) {
157 $this->
dbManager->queryOnce(
"INSERT INTO license_file (rf_fk, agent_fk, rf_match_pct, rf_timestamp, pfile_fk) 158 VALUES ($licenseRefNumber, $agentId, $matchPercent, $mydate, $pfileId)");
160 $this->
dbManager->queryOnce(
"INSERT INTO uploadtree (uploadtree_pk, upload_fk, pfile_fk, lft, rgt) 161 VALUES ($uploadtreeId, $uploadId, $pfileId, $left, $right)");
164 $itemTreeBounds =
new ItemTreeBounds($uploadtreeId,
"uploadtree",$uploadId,$left,$right);
165 $licenses = $licDao->getLicenseShortnamesContained($itemTreeBounds);
167 assertThat($licenses, is(arrayContainingInAnyOrder(array_values($licAll))));
169 $licensesForBadAgent = $licDao->getLicenseShortnamesContained($itemTreeBounds,array(2*$agentId));
170 assertThat($licensesForBadAgent, is(emptyArray()));
172 $licensesForNoAgent = $licDao->getLicenseShortnamesContained($itemTreeBounds,array());
173 assertThat($licensesForNoAgent, is(emptyArray()));
175 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
179 public function testGetLicenseIdPerPfileForAgentId()
181 $this->testDb->createPlainTables(array(
'license_ref',
'license_file',
'uploadtree',
'agent'));
182 $this->testDb->insertData(array(
'agent'));
183 $this->testDb->createViews(array(
'license_file_ref'));
184 $this->testDb->insertData_license_ref($limit=3);
185 $licAll = $this->
dbManager->createMap(
'license_ref',
'rf_pk',
'rf_shortname');
186 $rf_pk_all = array_keys($licAll);
187 $rf_pk = $rf_pk_all[0];
188 $uploadtreetable_name =
'uploadtree';
189 $this->
dbManager->insertInto(
'license_file',
190 'fl_pk, rf_fk, agent_fk, rf_match_pct, rf_timestamp, pfile_fk, server_fk',
191 array(1, $rf_pk, $agentId = 5, $matchPercent = 50, $mydate =
"'2014-06-04 14:01:30.551093+02'", $pfileId=42, 1) );
195 $containerMode = 1<<29;
196 $nonArtifactChildId = $uploadtreeId+2;
197 $this->
dbManager->insertTableRow(
'uploadtree',
198 array(
'uploadtree_pk'=>$uploadtreeId,
'upload_fk'=>$uploadId,
'pfile_fk'=>0,
199 'lft'=>$left,
'rgt'=>$left+5,
'parent'=>NULL,
'ufile_mode'=>$containerMode));
200 $this->
dbManager->insertTableRow(
'uploadtree',
201 array(
'uploadtree_pk'=>$uploadtreeId+1,
'upload_fk'=>$uploadId,
'pfile_fk'=>0,
202 'lft'=>$left+1,
'rgt'=>$left+4,
'parent'=>$uploadtreeId,
'ufile_mode'=>$containerMode));
203 $this->
dbManager->insertTableRow(
'uploadtree',
204 array(
'uploadtree_pk'=>$uploadtreeId+2,
'upload_fk'=>$uploadId,
'pfile_fk'=>$pfileId,
205 'lft'=>$left+2,
'rgt'=>$left+3,
'parent'=>$uploadtreeId+1,
'ufile_mode'=>0));
208 $itemTreeBounds =
new ItemTreeBounds($uploadtreeId,$uploadtreetable_name,$uploadId,$left,$left+5);
210 $row = array(
'pfile_id'=>$pfileId,
'license_id'=>$rf_pk,
'match_percentage'=>$matchPercent,
'agent_id'=>$agentId,
'uploadtree_pk'=>$nonArtifactChildId);
211 $expected = array($pfileId=>array($rf_pk=>$row));
212 $itemRestriction = array($nonArtifactChildId, $nonArtifactChildId+7);
214 $licensesForGoodAgent = $licDao->getLicenseIdPerPfileForAgentId($itemTreeBounds, $selectedAgentId = $agentId, $itemRestriction);
215 assertThat($licensesForGoodAgent, is(equalTo($expected)));
217 $licensesForBadAgent = $licDao->getLicenseIdPerPfileForAgentId($itemTreeBounds, $selectedAgentId = 1+$agentId, $itemRestriction);
218 assertThat($licensesForBadAgent, is(equalTo(array())));
220 $licensesOutside = $licDao->getLicenseIdPerPfileForAgentId($itemTreeBounds, $selectedAgentId = $agentId, array());
221 assertThat($licensesOutside, is(equalTo(array())));
223 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
226 public function testGetLicensesPerFileNameForAgentId()
228 $this->testDb->createPlainTables(array(
'license_ref',
'license_file',
'uploadtree',
'agent'));
229 $this->testDb->insertData(array(
'agent'));
230 $this->testDb->createViews(array(
'license_file_ref'));
231 $this->testDb->insertData_license_ref($limit=3);
232 $licAll = $this->
dbManager->createMap(
'license_ref',
'rf_pk',
'rf_shortname');
233 $rf_pk_all = array_keys($licAll);
235 $uploadtreetable_name =
'uploadtree';
256 $mainUploadtreeId = 80895;
257 $uploadtreeId = $mainUploadtreeId;
259 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'pfile_fk'=>70585,
'lft'=>1,
'rgt'=>36,
'ufile_mode'=>536904704,
'ufile_name'=>
'project.tar.gz'));
260 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80895,
'realparent'=>80895,
'pfile_fk'=>0,
'lft'=>2,
'rgt'=>35,
'ufile_mode'=>805323776,
'ufile_name'=>
'artifact.dir'));
261 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80896,
'realparent'=>80895,
'pfile_fk'=>70586,
'lft'=>3,
'rgt'=>34,
'ufile_mode'=>536903680,
'ufile_name'=>
'project.tar'));
262 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80897,
'realparent'=>80897,
'pfile_fk'=>0,
'lft'=>4,
'rgt'=>33,
'ufile_mode'=>805323776,
'ufile_name'=>
'artifact.dir'));
263 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80898,
'realparent'=>80897,
'pfile_fk'=>0,
'lft'=>5,
'rgt'=>32,
'ufile_mode'=>536888320,
'ufile_name'=>
'project'));
264 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80899,
'realparent'=>80899,
'pfile_fk'=>0,
'lft'=>6,
'rgt'=>7,
'ufile_mode'=>536888320,
'ufile_name'=>
'folderA'));
265 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80899,
'realparent'=>80899,
'pfile_fk'=>0,
'lft'=>24,
'rgt'=>31,
'ufile_mode'=>536888320,
'ufile_name'=>
'folderC'));
266 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80901,
'realparent'=>80901,
'pfile_fk'=>70587,
'lft'=>29,
'rgt'=>30,
'ufile_mode'=>33152,
'ufile_name'=>
'CfileC'));
267 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80901,
'realparent'=>80901,
'pfile_fk'=>70588,
'lft'=>25,
'rgt'=>26,
'ufile_mode'=>33152,
'ufile_name'=>
'CfileA'));
268 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80901,
'realparent'=>80901,
'pfile_fk'=>70589,
'lft'=>27,
'rgt'=>28,
'ufile_mode'=>33152,
'ufile_name'=>
'CfileB'));
269 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80899,
'realparent'=>80899,
'pfile_fk'=>0,
'lft'=>8,
'rgt'=>23,
'ufile_mode'=>536888320,
'ufile_name'=>
'folderB'));
270 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80905,
'realparent'=>80905,
'pfile_fk'=>0,
'lft'=>21,
'rgt'=>22,
'ufile_mode'=>536888320,
'ufile_name'=>
'subBfolderC'));
271 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80905,
'realparent'=>80905,
'pfile_fk'=>0,
'lft'=>9,
'rgt'=>10,
'ufile_mode'=>536888320,
'ufile_name'=>
'subBfolderA'));
272 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80905,
'realparent'=>80905,
'pfile_fk'=>0,
'lft'=>11,
'rgt'=>20,
'ufile_mode'=>536888320,
'ufile_name'=>
'subBfolderB'));
273 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80908,
'realparent'=>80908,
'pfile_fk'=>0,
'lft'=>12,
'rgt'=>19,
'ufile_mode'=>536888320,
'ufile_name'=>
'subBBsubBfolderA'));
274 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80909,
'realparent'=>80909,
'pfile_fk'=>70590,
'lft'=>17,
'rgt'=>18,
'ufile_mode'=>33152,
'ufile_name'=>
'BBBfileC'));
275 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80909,
'realparent'=>80909,
'pfile_fk'=>70591,
'lft'=>15,
'rgt'=>16,
'ufile_mode'=>33152,
'ufile_name'=>
'BBBfileB'));
276 $this->
dbManager->insertTableRow($uploadtreetable_name, array(
'uploadtree_pk'=>$uploadtreeId++,
'upload_fk'=>$uploadId,
'parent'=>80909,
'realparent'=>80909,
'pfile_fk'=>70592,
'lft'=>13,
'rgt'=>14,
'ufile_mode'=>33152,
'ufile_name'=>
'BBBfileA'));
285 $someDate =
"'2016-02-08 16:08:59.333096+00'";
286 $this->
dbManager->insertInto(
'license_file',
'fl_pk, rf_fk, agent_fk, rf_timestamp, pfile_fk, server_fk', array(1, $rf_pk_all[0], $agentId, $someDate, 70592, 1) );
287 $this->
dbManager->insertInto(
'license_file',
'fl_pk, rf_fk, agent_fk, rf_timestamp, pfile_fk, server_fk', array(2, $rf_pk_all[1], $agentId+1, $someDate, 70591, 1) );
288 $this->
dbManager->insertInto(
'license_file',
'fl_pk, rf_fk, agent_fk, rf_timestamp, pfile_fk, server_fk', array(3, $rf_pk_all[0], $agentId, $someDate, 70590, 1) );
289 $this->
dbManager->insertInto(
'license_file',
'fl_pk, rf_fk, agent_fk, rf_timestamp, pfile_fk, server_fk', array(4, $rf_pk_all[1], $agentId, $someDate, 70590, 1) );
292 $itemTreeBounds =
new ItemTreeBounds($mainUploadtreeId,$uploadtreetable_name,$uploadId,1,36);
296 $result = $licDao->getLicensesPerFileNameForAgentId($itemTreeBounds);
298 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileA";
299 $this->assertArrayHasKey($key, $result);
300 $expected = $licAll[$rf_pk_all[0]];
301 assertThat($result[$key][
'scanResults'][0], is(equalTo($expected)));
303 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileB";
304 $this->assertArrayHasKey($key, $result);
306 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileC";
307 $this->assertArrayHasKey($key, $result);
308 $this->assertContains($licAll[$rf_pk_all[0]],$result[$key][
'scanResults']);
309 $this->assertContains($licAll[$rf_pk_all[1]],$result[$key][
'scanResults']);
311 $key =
"project.tar.gz";
312 $this->assertArrayHasKey($key, $result);
316 $result = $licDao->getLicensesPerFileNameForAgentId($itemTreeBounds, array(),
true,
'',
true);
319 assertThat($result, is(equalTo($expected)));
323 $result = $licDao->getLicensesPerFileNameForAgentId($itemTreeBounds, array($agentId));
325 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileA";
326 $this->assertArrayHasKey($key, $result);
328 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileB";
329 $this->assertArrayNotHasKey($key, $result);
333 $result = $licDao->getLicensesPerFileNameForAgentId($itemTreeBounds, array($agentId),
true,
"fileC");
335 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileA";
336 $this->assertArrayHasKey($key, $result);
338 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileB";
339 $this->assertArrayNotHasKey($key, $result);
341 $key =
"project.tar.gz/project.tar/project/folderB/subBfolderB/subBBsubBfolderA/BBBfileC";
342 $this->assertArrayNotHasKey($key, $result);
346 $result = $licDao->getLicensesPerFileNameForAgentId($itemTreeBounds, array($agentId));
348 $key =
"project.tar.gz";
349 $this->assertArrayHasKey($key, $result);
351 $key =
"project.tar.gz/project.tar";
352 $this->assertArrayHasKey($key, $result);
354 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
357 public function testIsNewLicense()
360 $this->testDb->createPlainTables(array(
'license_ref'));
361 $this->testDb->insertData_license_ref();
362 $this->
dbManager->queryOnce(
"CREATE TABLE license_candidate AS SELECT *,$groupId group_fk FROM license_ref LIMIT 1");
363 $licCandi = $this->
dbManager->getSingleRow(
"SELECT * FROM license_candidate",array(),__METHOD__.
'.candi');
364 $this->
dbManager->queryOnce(
"DELETE FROM license_ref WHERE rf_pk=$licCandi[rf_pk]");
365 $licRef = $this->
dbManager->getSingleRow(
"SELECT * FROM license_ref LIMIT 1",array(),__METHOD__.
'.ref');
368 assertThat($this->
dbManager->getSingleRow(
369 "SELECT count(*) cnt FROM license_ref WHERE rf_shortname=$1",array($licCandi[
'rf_shortname']),__METHOD__.
'.check'),
370 is(equalTo(array(
'cnt'=>0))));
371 $this->assertCountBefore++;
373 assertThat($licDao->isNewLicense($licRef[
'rf_shortname'],$groupId), equalTo(FALSE));
374 assertThat($licDao->isNewLicense($licRef[
'rf_shortname'],0), equalTo(FALSE));
376 assertThat($licDao->isNewLicense($licCandi[
'rf_shortname'],$groupId), equalTo(FALSE));
377 assertThat($licDao->isNewLicense($licCandi[
'rf_shortname'],$groupId+1), equalTo(TRUE));
378 assertThat($licDao->isNewLicense($licCandi[
'rf_shortname'],0), equalTo(TRUE));
380 assertThat($licDao->isNewLicense(
'(a new shortname)',$groupId), equalTo(TRUE));
381 assertThat($licDao->isNewLicense(
'(a new shortname)',0), equalTo(TRUE));
383 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
386 public function testGetAgentFileLicenseMatchesWithLicenseMapping()
388 $this->testDb->createPlainTables(array(
'license_ref',
'uploadtree',
'license_file',
'agent',
'license_map'));
389 $this->testDb->insertData_license_ref();
391 $lic0 = $this->
dbManager->getSingleRow(
"Select * from license_ref limit 1",array(),__METHOD__.
'.anyLicense');
392 $licRefId = $lic0[
'rf_pk'];
403 $lic1 = $this->
dbManager->getSingleRow(
"SELECT * FROM license_ref WHERE rf_pk!=$1 LIMIT 1",array($licRefId),__METHOD__.
'.anyOtherLicense');
404 $licVarId = $lic1[
'rf_pk'];
405 $mydate =
"'2014-06-04 14:01:30.551093+02'";
406 $this->
dbManager->insertTableRow(
'license_map', array(
'license_map_pk'=>0,
'rf_fk'=>$licVarId,
'rf_parent'=>$licRefId,
'usage'=>LicenseMap::CONCLUSION));
407 $this->
dbManager->queryOnce(
"INSERT INTO license_file (fl_pk, rf_fk, agent_fk, rf_match_pct, rf_timestamp, pfile_fk) 408 VALUES ($licenseFileId, $licVarId, $agentId, $matchPercent, $mydate, $pfileId)");
409 $this->
dbManager->queryOnce(
"INSERT INTO uploadtree (uploadtree_pk, upload_fk, pfile_fk, lft, rgt) 410 VALUES ($uploadtreeId, $uploadID, $pfileId, $left, $right)");
411 $stmt = __METHOD__.
'.insert.agent';
412 $this->
dbManager->prepare($stmt,
"INSERT INTO agent (agent_pk, agent_name, agent_rev, agent_enabled) VALUES ($1,$2,$3,$4)");
413 $this->
dbManager->execute($stmt,array($agentId, $agentName, $agentRev,
'true'));
416 $itemTreeBounds =
new ItemTreeBounds($uploadtreeId,
"uploadtree",$uploadID,$left,$right);
417 $matches = $licDao->getAgentFileLicenseMatches($itemTreeBounds,LicenseMap::CONCLUSION);
419 $licenseRef =
new LicenseRef($licRefId, $lic0[
'rf_shortname'], $lic0[
'rf_fullname']);
420 $agentRef =
new AgentRef($agentId, $agentName, $agentRev);
421 $expected = array(
new LicenseMatch($pfileId, $licenseRef, $agentRef, $licenseFileId, $matchPercent) );
423 assertThat($matches, equalTo($expected));
424 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
fo_dbManager * dbManager
fo_dbManager object