31 private $sameUpload =
true;
33 private $sameFolder =
true;
35 private $clearingEvent;
39 private $uploadTreeId;
53 private $acknowledgement;
60 private $clearingDecisionBuilder;
62 protected function setUp()
64 $this->sameUpload =
true;
65 $this->sameFolder =
true;
66 $this->clearingEvent = M::mock(ClearingEvent::class);
67 $this->clearingId = 8;
68 $this->uploadTreeId = 9;
70 $this->userName =
"tester";
72 $this->type = DecisionTypes::TO_BE_DISCUSSED;
73 $this->comment =
"Test comment";
74 $this->reportinfo =
"Test reportinfo";
75 $this->acknowledgement =
"Test acknowledgement";
76 $this->scope = DecisionScopes::ITEM;
77 $this->timeStamp = mktime(11, 14, 15, 7, 28, 2012);
80 $this->assertCountBefore = \Hamcrest\MatcherAssert::getCount();
83 protected function tearDown()
85 $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()-$this->assertCountBefore);
89 public function testSameFolder()
91 $clearingDec =$this->clearingDecisionBuilder
92 ->setSameFolder($this->sameFolder)
94 assertThat($clearingDec->getSameFolder(), is($this->sameFolder));
97 public function testClearingLicenses()
99 $clearingDec = $this->clearingDecisionBuilder
100 ->setClearingEvents(array($this->clearingEvent))
102 assertThat($clearingDec->getClearingEvents(), is(arrayContaining($this->clearingEvent)));
105 public function testPositiveLicenses()
107 $addedLic = M::mock(LicenseRef::class);
109 $addedClearingLic = M::mock(ClearingLicense::class);
110 $addedClearingLic->shouldReceive(
'isRemoved')->withNoArgs()->andReturn(
false);
111 $addedClearingLic->shouldReceive(
'getLicenseRef')->withNoArgs()->andReturn($addedLic);
113 $removedClearingLic = M::mock(ClearingLicense::class);
114 $removedClearingLic->shouldReceive(
'isRemoved')->andReturn(
true);
116 $removedClearingEvent = M::mock(ClearingEvent::class);
118 $this->clearingEvent->shouldReceive(
'getClearingLicense')->andReturn($addedClearingLic);
119 $removedClearingEvent->shouldReceive(
'getClearingLicense')->andReturn($removedClearingLic);
121 $clearingDec = $this->clearingDecisionBuilder
122 ->setClearingEvents(array($this->clearingEvent, $removedClearingEvent))
124 assertThat($clearingDec->getPositiveLicenses(), is(arrayContaining($addedLic)));
127 public function testClearingId()
129 $clearingDec = $this->clearingDecisionBuilder
130 ->setClearingId($this->clearingId)
132 assertThat($clearingDec->getClearingId(), is($this->clearingId));
135 public function testUploadTreeId()
137 $clearingDec = $this->clearingDecisionBuilder
138 ->setUploadTreeId($this->uploadTreeId)
140 assertThat($clearingDec->getUploadTreeId(), is($this->uploadTreeId));
143 public function testPfileId()
145 $clearingDec = $this->clearingDecisionBuilder
146 ->setPfileId($this->pfileId)
148 assertThat($clearingDec->getPfileId(), is($this->pfileId));
151 public function testUserName()
153 $clearingDec = $this->clearingDecisionBuilder
154 ->setUserName($this->userName)
156 assertThat($clearingDec->getUserName(), is($this->userName));
159 public function testUserId()
161 $clearingDec = $this->clearingDecisionBuilder
162 ->setUserId($this->userId)
164 assertThat($clearingDec->getUserId(), is($this->userId));
167 public function testType()
169 $clearingDec = $this->clearingDecisionBuilder
170 ->setType($this->type)
172 assertThat($clearingDec->getType(), is($this->type));
175 public function testDateAdded()
177 $clearingDec = $this->clearingDecisionBuilder
178 ->setTimeStamp($this->timeStamp)
180 assertThat($clearingDec->getTimeStamp(), is($this->timeStamp));