ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTermsOfServiceAcceptanceEntityTest.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 public function testInstanceCanBeCreated() : void
14 {
16 $this->assertInstanceOf(ilTermsOfServiceAcceptanceEntity::class, $entity);
17 }
18
22 public function testIdIsInitiallyEmpty() : void
23 {
25 $this->assertEmpty($entity->getId());
26 }
27
31 public function testUserIdIsInitiallyEmpty() : void
32 {
34 $this->assertEmpty($entity->getUserId());
35 }
36
40 public function testTextIsInitiallyEmpty() : void
41 {
43 $this->assertEmpty($entity->getText());
44 }
45
49 public function testTitleIsInitiallyEmpty() : void
50 {
52 $this->assertEmpty($entity->getTitle());
53 }
54
58 public function testDocumentIdIsInitiallyEmpty() : void
59 {
61 $this->assertEmpty($entity->getDocumentId());
62 }
63
68 {
70 $this->assertEmpty($entity->getTimestamp());
71 }
72
76 public function testHashIsInitiallyEmpty() : void
77 {
79 $this->assertEmpty($entity->getHash());
80 }
81
85 public function testCriteriaAreInitiallyEmpty() : void
86 {
88 $this->assertEmpty($entity->getSerializedCriteria());
89 }
90
94 public function testEntityShouldReturnIdWhenIdIsSet() : void
95 {
96 $expected = 4711;
97
99 $this->assertEquals($expected, $entity->withId($expected)->getId());
100 }
101
106 {
107 $expected = 1337;
108
109 $entity = new ilTermsOfServiceAcceptanceEntity();
110 $this->assertEquals($expected, $entity->withUserId($expected)->getUserId());
111 }
112
117 {
118 $expected = 'Lorem Ipsum';
119
120 $entity = new ilTermsOfServiceAcceptanceEntity();
121 $this->assertEquals($expected, $entity->withText($expected)->getText());
122 }
123
128 {
129 $expected = 4711;
130
131 $entity = new ilTermsOfServiceAcceptanceEntity();
132 $this->assertEquals($expected, $entity->withDocumentId($expected)->getDocumentId());
133 }
134
139 {
140 $expected = 'Document PHP Unit';
141
142 $entity = new ilTermsOfServiceAcceptanceEntity();
143 $this->assertEquals($expected, $entity->withTitle($expected)->getTitle());
144 }
145
150 {
151 $expected = time();
152
153 $entity = new ilTermsOfServiceAcceptanceEntity();
154 $this->assertEquals($expected, $entity->withTimestamp($expected)->getTimestamp());
155 }
156
161 {
162 $expected = 'hash';
163
164 $entity = new ilTermsOfServiceAcceptanceEntity();
165 $this->assertEquals($expected, $entity->withHash($expected)->getHash());
166 }
167
172 {
173 $expected = 'criteria';
174
175 $entity = new ilTermsOfServiceAcceptanceEntity();
176 $this->assertEquals($expected, $entity->withSerializedCriteria($expected)->getSerializedCriteria());
177 }
178}
An exception for terminatinating execution or to throw for unit testing.
Class ilTermsOfServiceAcceptanceEntityTest.
Class ilTermsOfServiceAcceptanceEntity.
Class ilTermsOfServiceBaseTest.