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); }