protected function setUp()
 {
     $this->uploadTreeId = 432;
     $this->pfileId = 32;
     $this->userId = 12;
     $this->groupId = 5;
     $this->timestamp = time();
     $this->clearingDao = M::mock(ClearingDao::classname());
     $this->agentLicenseEventProcessor = M::mock(AgentLicenseEventProcessor::classname());
     $this->clearingEventProcessor = new ClearingEventProcessor();
     $this->itemTreeBounds = M::mock(ItemTreeBounds::classname());
     $this->itemTreeBounds->shouldReceive("getItemId")->withNoArgs()->andReturn($this->uploadTreeId);
     $this->itemTreeBounds->shouldReceive("getPfileId")->withNoArgs()->andReturn($this->pfileId);
     $this->dbManager = M::mock(DbManager::classname());
     $this->dbManager->shouldReceive('begin')->withNoArgs();
     $this->dbManager->shouldReceive('commit')->withNoArgs();
     $this->clearingDecisionProcessor = new ClearingDecisionProcessor($this->clearingDao, $this->agentLicenseEventProcessor, $this->clearingEventProcessor, $this->dbManager);
     $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
 }
 public function testGetScannerDetectedLicenseDetailsNoLicenseFoundShouldBeSkipped()
 {
     $uploadId = 2;
     list($licenseMatch1, $licenseRef1, $agentRef1) = $this->createLicenseMatch(5, "No_license_found", 23, "nomos", 453, null);
     $licenseMatches = array($licenseMatch1);
     $this->itemTreeBounds->shouldReceive('getUploadId')->withNoArgs()->andReturn($uploadId);
     $this->licenseDao->shouldReceive('getAgentFileLicenseMatches')->once()->withArgs(array($this->itemTreeBounds, LicenseMap::TRIVIAL))->andReturn($licenseMatches);
     // $latestAgentDetectedLicenses = $this->agentLicenseEventProcessor->getScannerDetectedLicenseDetails($this->itemTreeBounds);
     $reflection = new \ReflectionClass($this->agentLicenseEventProcessor);
     $method = $reflection->getMethod('getScannerDetectedLicenseDetails');
     $method->setAccessible(true);
     $latestAgentDetectedLicenses = $method->invoke($this->agentLicenseEventProcessor, $this->itemTreeBounds);
     assertThat($latestAgentDetectedLicenses, is(array()));
 }
示例#3
0
 public function testDoesNotContainFileTreeItems()
 {
     $this->itemTreeBounds->shouldReceive("containsFiles")->withNoArgs()->andReturn(false);
     $this->assertFalse($this->item->containsFileTreeItems());
 }
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage constraint bar is not defined
  */
 public function testExcpetionWithUnknownConstraint()
 {
     $this->itemTreeBounds->shouldReceive("getUploadTreeTableName")->once()->withNoArgs()->andReturn("foo");
     new UploadTreeViewProxy($this->itemTreeBounds, array('bar'));
 }