Exemplo n.º 1
0
 public function testGetLicenseIdWithClearingEvent()
 {
     $licenseId = 123;
     $this->clearingEvent->shouldReceive("getLicenseId")->once()->andReturn($licenseId);
     $this->licenseDecisionResult = new ClearingResult($this->clearingEvent, array($this->agentClearingEvent1));
     assertThat($this->licenseDecisionResult->getLicenseId(), is($licenseId));
 }
 public function testPositiveLicenses()
 {
     $addedLic = M::mock(LicenseRef::classname());
     $addedClearingLic = M::mock(ClearingLicense::classname());
     $addedClearingLic->shouldReceive('isRemoved')->withNoArgs()->andReturn(false);
     $addedClearingLic->shouldReceive('getLicenseRef')->withNoArgs()->andReturn($addedLic);
     $removedClearingLic = M::mock(ClearingLicense::classname());
     $removedClearingLic->shouldReceive('isRemoved')->andReturn(true);
     $removedClearingEvent = M::mock(ClearingEvent::classname());
     $this->clearingEvent->shouldReceive('getClearingLicense')->andReturn($addedClearingLic);
     $removedClearingEvent->shouldReceive('getClearingLicense')->andReturn($removedClearingLic);
     $clearingDec = $this->clearingDecisionBuilder->setClearingEvents(array($this->clearingEvent, $removedClearingEvent))->build();
     assertThat($clearingDec->getPositiveLicenses(), is(arrayContaining($addedLic)));
 }
 protected function setUp()
 {
     $this->timestamp = time();
     $this->clearingEventProcessor = new ClearingEventProcessor();
     $this->addedLicense = M::mock(ClearingLicense::classname());
     $this->addedLicense->shouldReceive("getShortName")->withNoArgs()->andReturn($this->addedName);
     $this->addedLicense->shouldReceive("getId")->withNoArgs()->andReturn($this->addedId);
     $this->addedEvent = M::mock(ClearingEvent::classname());
     $this->addedEvent->shouldReceive("getLicenseShortName")->withNoArgs()->andReturn($this->addedName);
     $this->addedEvent->shouldReceive("getLicenseId")->withNoArgs()->andReturn($this->addedId);
     $this->addedEvent->shouldReceive("getClearingLicense")->withNoArgs()->andReturn($this->addedLicense);
     $this->addedEvent->shouldReceive("getTimeStamp")->withNoArgs()->andReturn($this->timestamp);
     $this->addedEvent->shouldReceive("isRemoved")->withNoArgs()->andReturn(false);
     $this->removedLicense = M::mock(ClearingLicense::classname());
     $this->removedLicense->shouldReceive("getShortName")->withNoArgs()->andReturn($this->removedName);
     $this->removedLicense->shouldReceive("getId")->withNoArgs()->andReturn($this->removedId);
     $this->removedEvent = M::mock(ClearingEvent::classname());
     $this->removedEvent->shouldReceive("getLicenseShortName")->withNoArgs()->andReturn($this->removedName);
     $this->removedEvent->shouldReceive("getLicenseId")->withNoArgs()->andReturn($this->removedId);
     $this->removedEvent->shouldReceive("getClearingLicense")->withNoArgs()->andReturn($this->removedLicense);
     $this->removedEvent->shouldReceive("getTimeStamp")->withNoArgs()->andReturn($this->timestamp);
     $this->removedEvent->shouldReceive("isRemoved")->withNoArgs()->andReturn(true);
 }
Exemplo n.º 4
0
 public function testRelevantClearingEvents()
 {
     $groupId = 701;
     $this->buildProposals(array(array(301, 1, $groupId, 401, false, -99), array(301, 2, $groupId, 402, true, -98), array(301, 2, $groupId, 401, true, -97)), $firstEventId = 0);
     $this->buildDecisions(array(array(301, 1, $groupId, DecisionTypes::IDENTIFIED, -90, DecisionScopes::REPO, array($firstEventId, $firstEventId + 1, $firstEventId + 2))));
     $itemTreeBounds = M::mock(ItemTreeBounds::classname());
     $itemTreeBounds->shouldReceive('getItemId')->andReturn(301);
     $itemTreeBounds->shouldReceive('getUploadTreeTableName')->andReturn('uploadtree');
     $itemTreeBounds->shouldReceive('containsFiles')->andReturn(false);
     $itemTreeBounds->shouldReceive('getUploadId')->andReturn($this->items[301][0]);
     $itemTreeBounds->shouldReceive('getLeft')->andReturn($this->items[301][4]);
     $itemTreeBounds->shouldReceive('getRight')->andReturn($this->items[301][5]);
     $events1 = $this->clearingDao->getRelevantClearingEvents($itemTreeBounds, $groupId);
     assertThat($events1, arrayWithSize(2));
     assertThat($events1, hasKeyInArray(401));
     assertThat($events1, hasKeyInArray(402));
     assertThat($events1[401], is(anInstanceOf(ClearingEvent::classname())));
     assertThat($events1[402]->getEventId(), is($firstEventId + 1));
     assertThat($events1[401]->getEventId(), is($firstEventId + 2));
 }
Exemplo n.º 5
0
 /**
  * @return string
  */
 public function getReportinfo()
 {
     return isset($this->clearingEvent) ? $this->clearingEvent->getReportinfo() : '';
 }
Exemplo n.º 6
0
 public function testGetGroupId()
 {
     assertThat($this->licenseDecisionEvent->getGroupId(), is($this->groupId));
 }