ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTermsOfServiceAcceptanceEntityTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceAcceptanceEntity.php';
5require_once 'Services/TermsOfService/test/ilTermsOfServiceBaseTest.php';
6
12{
16 protected $backupGlobals = false;
17
21 public function setUp()
22 {
23 }
24
28 public function testInstanceCanBeCreated()
29 {
31 $this->assertInstanceOf('ilTermsOfServiceAcceptanceEntity', $entity);
32 }
33
37 public function testIdIsInitiallyEmpty()
38 {
40 $this->assertEmpty($entity->getId());
41 }
42
47 {
49 $this->assertEmpty($entity->getUserId());
50 }
51
55 public function testTextIsInitiallyEmpty()
56 {
58 $this->assertEmpty($entity->getText());
59 }
60
65 {
67 $this->assertEmpty($entity->getSource());
68 }
69
74 {
76 $this->assertEmpty($entity->getSourceType());
77 }
78
83 {
85 $this->assertEmpty($entity->getIso2LanguageCode());
86 }
87
92 {
94 $this->assertEmpty($entity->getTimestamp());
95 }
96
100 public function testHashIsInitiallyEmpty()
101 {
102 $entity = new ilTermsOfServiceAcceptanceEntity();
103 $this->assertEmpty($entity->getHash());
104 }
105
110 {
111 $expected = 4711;
112
113 $entity = new ilTermsOfServiceAcceptanceEntity();
114 $entity->setId($expected);
115 $this->assertEquals($expected, $entity->getId());
116 }
117
122 {
123 $expected = 1337;
124
125 $entity = new ilTermsOfServiceAcceptanceEntity();
126 $entity->setUserId($expected);
127 $this->assertEquals($expected, $entity->getUserId());
128 }
129
134 {
135 $expected = 'Lorem Ipsum';
136
137 $entity = new ilTermsOfServiceAcceptanceEntity();
138 $entity->setText($expected);
139 $this->assertEquals($expected, $entity->getText());
140 }
141
146 {
147 $expected = '/path/to/file';
148
149 $entity = new ilTermsOfServiceAcceptanceEntity();
150 $entity->setSource($expected);
151 $this->assertEquals($expected, $entity->getSource());
152 }
153
158 {
159 $expected = 1;
160
161 $entity = new ilTermsOfServiceAcceptanceEntity();
162 $entity->setSourceType($expected);
163 $this->assertEquals($expected, $entity->getSourceType());
164 }
165
170 {
171 $expected = 'de';
172
173 $entity = new ilTermsOfServiceAcceptanceEntity();
174 $entity->setIso2LanguageCode($expected);
175 $this->assertEquals($expected, $entity->getIso2LanguageCode());
176 }
177
182 {
183 $expected = time();
184
185 $entity = new ilTermsOfServiceAcceptanceEntity();
186 $entity->setTimestamp($expected);
187 $this->assertEquals($expected, $entity->getTimestamp());
188 }
189
194 {
195 $expected = 'hash';
196
197 $entity = new ilTermsOfServiceAcceptanceEntity();
198 $entity->setHash($expected);
199 $this->assertEquals($expected, $entity->getHash());
200 }
201}
An exception for terminatinating execution or to throw for unit testing.