Class ilTermsOfServiceHelperTest.
More...
◆ testAcceptanceHistoryCanBeDeleted()
ilTermsOfServiceHelperTest::testAcceptanceHistoryCanBeDeleted |
( |
| ) |
|
- Exceptions
-
Definition at line 97 of file ilTermsOfServiceHelperTest.php.
99 $dataGatewayFactory = $this->getMockBuilder(ilTermsOfServiceDataGatewayFactory::class)->getMock();
101 ->getMockBuilder(ilTermsOfServiceAcceptanceDataGateway::class)
105 ->expects($this->once())
106 ->method(
'deleteAcceptanceHistoryByUser')
107 ->with($this->isInstanceOf(ilTermsOfServiceAcceptanceEntity::class));
110 ->expects($this->any())
111 ->method(
'getByName')
112 ->willReturn($dataGateway);
116 $this->getMockBuilder(ilTermsOfServiceDocumentEvaluation::class)->getMock(),
117 $this->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)->getMock(),
118 $this->getMockBuilder(ilObjTermsOfService::class)->disableOriginalConstructor()->getMock()
122 ->getMockBuilder(ilObjUser::class)
123 ->disableOriginalConstructor()
124 ->onlyMethods([
'getId',
'getLogin'])
128 ->expects($this->any())
133 ->expects($this->any())
135 ->willReturn(
'phpunit');
137 $helper->deleteAcceptanceHistoryByUser(
$user->getId());
Class ilTermsOfServiceHelper.
◆ testAcceptanceHistoryEntityCanBeLoadedById()
ilTermsOfServiceHelperTest::testAcceptanceHistoryEntityCanBeLoadedById |
( |
| ) |
|
- Exceptions
-
Definition at line 196 of file ilTermsOfServiceHelperTest.php.
198 $dataGatewayFactory = $this->getMockBuilder(ilTermsOfServiceDataGatewayFactory::class)->getMock();
200 ->getMockBuilder(ilTermsOfServiceAcceptanceDataGateway::class)
204 $entity->withId(4711);
207 ->expects($this->atLeast(1))
209 ->willReturn($entity);
212 ->expects($this->any())
213 ->method(
'getByName')
214 ->willReturn($dataGateway);
218 $this->getMockBuilder(ilTermsOfServiceDocumentEvaluation::class)->getMock(),
219 $this->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)->getMock(),
220 $this->getMockBuilder(ilObjTermsOfService::class)->disableOriginalConstructor()->getMock()
224 ->getMockBuilder(ilObjUser::class)
225 ->disableOriginalConstructor()
226 ->onlyMethods([
'getId',
'getLogin'])
230 ->expects($this->any())
235 ->expects($this->any())
237 ->willReturn(
'phpunit');
239 $this->assertInstanceOf(ilTermsOfServiceAcceptanceEntity::class, $helper->getById($entity->getId()));
240 $this->assertEquals($entity, $helper->getById($entity->getId()));
Class ilTermsOfServiceHelper.
Class ilTermsOfServiceAcceptanceEntity.
◆ testDocumentCanBeAccepted()
ilTermsOfServiceHelperTest::testDocumentCanBeAccepted |
( |
| ) |
|
- Exceptions
-
Definition at line 15 of file ilTermsOfServiceHelperTest.php.
17 $dataGatewayFactory = $this->getMockBuilder(ilTermsOfServiceDataGatewayFactory::class)->getMock();
19 ->getMockBuilder(ilTermsOfServiceAcceptanceDataGateway::class)
23 ->expects($this->once())
24 ->method(
'trackAcceptance')
25 ->with($this->isInstanceOf(ilTermsOfServiceAcceptanceEntity::class));
28 ->expects($this->any())
30 ->willReturn($dataGateway);
34 $this->getMockBuilder(ilTermsOfServiceDocumentEvaluation::class)->getMock(),
35 $this->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)->getMock(),
36 $this->getMockBuilder(ilObjTermsOfService::class)->disableOriginalConstructor()->getMock()
40 ->getMockBuilder(ilObjUser::class)
41 ->disableOriginalConstructor()
42 ->onlyMethods([
'getLanguage',
'getId',
'getLogin',
'writeAccepted',
'hasToAcceptTermsOfServiceInSession'])
46 ->expects($this->any())
51 ->expects($this->any())
53 ->willReturn(
'phpunit');
56 ->expects($this->once())
57 ->method(
'writeAccepted');
60 ->expects($this->once())
61 ->method(
'hasToAcceptTermsOfServiceInSession')
65 ->getMockBuilder(ilTermsOfServiceDocument::class)
66 ->disableOriginalConstructor()
67 ->onlyMethods([
'content',
'id',
'criteria',
'title'])
71 ->expects($this->atLeast(1))
73 ->willReturn(
'phpunit');
76 ->expects($this->atLeast(1))
78 ->willReturn(
'phpunit');
81 ->expects($this->atLeast(1))
86 ->expects($this->atLeast(1))
90 $helper->trackAcceptance(
$user, $document);
Class ilTermsOfServiceHelper.
◆ testLatestAcceptanceHistoryEntityCanBeLoadedForUser()
ilTermsOfServiceHelperTest::testLatestAcceptanceHistoryEntityCanBeLoadedForUser |
( |
| ) |
|
- Exceptions
-
Definition at line 144 of file ilTermsOfServiceHelperTest.php.
146 $dataGatewayFactory = $this->getMockBuilder(ilTermsOfServiceDataGatewayFactory::class)->getMock();
148 ->getMockBuilder(ilTermsOfServiceAcceptanceDataGateway::class)
152 $entity->withId(4711);
155 ->expects($this->atLeast(1))
156 ->method(
'loadCurrentAcceptanceOfUser')
157 ->with($this->isInstanceOf(ilTermsOfServiceAcceptanceEntity::class))
158 ->willReturn($entity);
161 ->expects($this->any())
162 ->method(
'getByName')
163 ->willReturn($dataGateway);
167 $this->getMockBuilder(ilTermsOfServiceDocumentEvaluation::class)->getMock(),
168 $this->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)->getMock(),
169 $this->getMockBuilder(ilObjTermsOfService::class)->disableOriginalConstructor()->getMock()
173 ->getMockBuilder(ilObjUser::class)
174 ->disableOriginalConstructor()
175 ->onlyMethods([
'getId',
'getLogin'])
179 ->expects($this->any())
184 ->expects($this->any())
186 ->willReturn(
'phpunit');
188 $this->assertInstanceOf(ilTermsOfServiceAcceptanceEntity::class, $helper->getCurrentAcceptanceForUser(
$user));
189 $this->assertEquals($entity, $helper->getCurrentAcceptanceForUser(
$user));
Class ilTermsOfServiceHelper.
Class ilTermsOfServiceAcceptanceEntity.
The documentation for this class was generated from the following file: