8 namespace Fossology\Lib\Data\Clearing;
15 private $eventId = 12;
17 private $uploadTreeId = 5;
21 private $groupId = 123;
23 private $eventType = ClearingEventTypes::USER;
25 private $clearingLicense;
27 private $licenseDecisionEvent;
31 protected function setUp() :
void
33 $this->timestamp = time();
34 $this->clearingLicense = M::mock(ClearingLicense::class);
36 $this->licenseDecisionEvent =
new ClearingEvent($this->eventId, $this->uploadTreeId, $this->timestamp, $this->userId, $this->groupId, $this->eventType, $this->clearingLicense);
37 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
40 protected function tearDown() :
void
42 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
45 public function testGetEventId()
47 assertThat($this->licenseDecisionEvent->getEventId(), is($this->eventId));
50 public function testGetEventType()
52 assertThat($this->licenseDecisionEvent->getEventType(), is($this->eventType));
55 public function testGetTimeStamp()
57 assertThat($this->licenseDecisionEvent->getTimeStamp(), is($this->timestamp));
60 public function testGetClearingLicense()
62 assertThat($this->licenseDecisionEvent->getClearingLicense(),
63 is($this->clearingLicense));
66 public function testGetUploadTreeId()
68 assertThat($this->licenseDecisionEvent->getUploadTreeId(),
69 is($this->uploadTreeId));
72 public function testGetLicenseId()
75 $this->clearingLicense->shouldReceive(
'getLicenseId')
78 ->andReturn($licenseId);
80 assertThat($this->licenseDecisionEvent->getLicenseId(), is($licenseId));
83 public function testGetLicenseShortName()
85 $licenseShortname =
"<licenseShortname>";
86 $this->clearingLicense->shouldReceive(
'getShortName')
89 ->andReturn($licenseShortname);
91 assertThat($this->licenseDecisionEvent->getLicenseShortName(),
92 is($licenseShortname));
95 public function testGetLicenseFullName()
97 $licenseFullname =
"<licenseFullname>";
98 $this->clearingLicense->shouldReceive(
'getFullName')
101 ->andReturn($licenseFullname);
103 assertThat($this->licenseDecisionEvent->getLicenseFullName(),
104 is($licenseFullname));
107 public function testGetUserId()
109 assertThat($this->licenseDecisionEvent->getUserId(), is($this->userId));
112 public function testGetGroupId()
114 assertThat($this->licenseDecisionEvent->getGroupId(), is($this->groupId));