/** * @return string */ public function getLicenseFullName() { return $this->clearingLicense->getFullName(); }
public function testFilterEffectiveEventsOppositeIdenticalEventsOverwriteInOtherOrder() { $events = array(); $licenseRef1 = M::mock(ClearingLicense::classname()); $licenseRef1->shouldReceive("getLicenseId")->withNoArgs()->andReturn("fortyTwo"); $events[] = $this->createEvent($this->timestamp, $licenseRef1); $licenseRef2 = M::mock(ClearingLicense::classname()); $licenseRef2->shouldReceive("getLicenseId")->withNoArgs()->andReturn("fortyTwo"); $events[] = $this->createEvent($this->timestamp + 60, $licenseRef2); $filteredEvents = $this->clearingEventProcessor->filterEffectiveEvents($events); assertThat($filteredEvents, is(arrayWithSize(1))); assertThat($filteredEvents, hasKeyValuePair('fortyTwo', $events[1])); }
public function testGetLicenseFullName() { $licenseFullname = "<licenseFullname>"; $this->clearingLicense->shouldReceive('getFullName')->once()->withNoArgs()->andReturn($licenseFullname); assertThat($this->licenseDecisionEvent->getLicenseFullName(), is($licenseFullname)); }
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 insertDecisionFromTwoEvents($scope = DecisionScopes::ITEM, $originallyClearedItemId = 23) { $licenseRef1 = $this->licenseDao->getLicenseByShortName("GPL-3.0")->getRef(); $licenseRef2 = $this->licenseDao->getLicenseByShortName("3DFX")->getRef(); $addedLicenses = array($licenseRef1, $licenseRef2); assertThat($addedLicenses, not(arrayContaining(null))); $clearingLicense1 = new ClearingLicense($licenseRef1, false, ClearingEventTypes::USER, "42", "44"); $clearingLicense2 = new ClearingLicense($licenseRef2, true, ClearingEventTypes::USER, "-42", "-44"); $eventId1 = $this->clearingDao->insertClearingEvent($originallyClearedItemId, $this->userId, $this->groupId, $licenseRef1->getId(), $clearingLicense1->isRemoved(), $clearingLicense1->getType(), $clearingLicense1->getReportinfo(), $clearingLicense1->getComment()); $eventId2 = $this->clearingDao->insertClearingEvent($originallyClearedItemId, 5, $this->groupId, $licenseRef2->getId(), $clearingLicense2->isRemoved(), $clearingLicense2->getType(), $clearingLicense2->getReportinfo(), $clearingLicense2->getComment()); $addedEventIds = array($eventId1, $eventId2); $this->clearingDao->createDecisionFromEvents($originallyClearedItemId, $this->userId, $this->groupId, DecisionTypes::IDENTIFIED, $scope, $addedEventIds); return array($clearingLicense1, $clearingLicense2, $addedEventIds); }