Class ilTermsOfServiceSettingsFormGUITest.
More...
◆ testFormCanBeProperlyBuilt()
ilTermsOfServiceSettingsFormGUITest::testFormCanBeProperlyBuilt |
( |
| ) |
|
Definition at line 13 of file ilTermsOfServiceSettingsFormGUITest.php.
References $form.
15 $tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
18 ->expects($this->any())
22 $form = new \ilTermsOfServiceSettingsFormGUI(
29 $this->assertCount(1,
$form->getCommandButtons(),
'Failed asserting save button is given if form is editable');
30 $this->assertArrayHasKey(0,
$form->getCommandButtons(),
'Failed asserting save button ist given if form is editable');
31 $this->assertEquals(
'save',
$form->getCommandButtons()[0][
'cmd'],
'Failed asserting save button ist given if form is editable');
33 $form = new \ilTermsOfServiceSettingsFormGUI(
40 $this->assertCount(0, $form->getCommandButtons(),
'Failed asserting no button is given if form is not editable');
if(isset($_POST['submit'])) $form
◆ testFormCanBeSavedWithDisabledService()
ilTermsOfServiceSettingsFormGUITest::testFormCanBeSavedWithDisabledService |
( |
| ) |
|
Definition at line 46 of file ilTermsOfServiceSettingsFormGUITest.php.
References $_POST, $form, and Sabre\Event\once().
48 $tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
51 ->expects($this->any())
56 ->expects($this->
once())
57 ->method(
'saveStatus')
60 $form = $this->getMockBuilder(\ilTermsOfServiceSettingsFormGUI::class)
61 ->setConstructorArgs([
65 ->setMethods([
'checkInput',
'getInput'])
69 ->expects($this->
once())
70 ->method(
'checkInput')
74 ->expects($this->exactly(2))
82 $form->setCheckInputCalled(
true);
84 $this->assertTrue(
$form->saveObject());
85 $this->assertFalse(
$form->hasTranslatedError());
86 $this->assertEmpty(
$form->getTranslatedError());
if(isset($_POST['submit'])) $form
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
◆ testFormCanBeSavedWithEnabledServiceWhenAtLeastOneDocumentExists()
ilTermsOfServiceSettingsFormGUITest::testFormCanBeSavedWithEnabledServiceWhenAtLeastOneDocumentExists |
( |
| ) |
|
Definition at line 92 of file ilTermsOfServiceSettingsFormGUITest.php.
References $_POST, $form, Sabre\Event\once(), and arConnectorMap\register().
94 $tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
97 ->expects($this->any())
102 ->expects($this->
once())
103 ->method(
'saveStatus')
106 $form = $this->getMockBuilder(\ilTermsOfServiceSettingsFormGUI::class)
107 ->setConstructorArgs([
111 ->setMethods([
'checkInput',
'getInput'])
115 ->expects($this->
once())
116 ->method(
'checkInput')
120 ->expects($this->exactly(2))
128 $form->setCheckInputCalled(
true);
130 $documentConnector = $this->getMockBuilder(\arConnector::class)->getMock();#
133 ->expects($this->
once())
134 ->method(
'affectedRows')
139 $this->assertTrue(
$form->saveObject());
140 $this->assertFalse(
$form->hasTranslatedError());
141 $this->assertEmpty(
$form->getTranslatedError());
static register(ActiveRecord $ar, arConnector $connector)
if(isset($_POST['submit'])) $form
Class ilTermsOfServiceDocument.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
◆ testFormCanBeSavedWithEnabledServiceWhenNoDocumentsExistButServiceIsAlreadyEnabled()
ilTermsOfServiceSettingsFormGUITest::testFormCanBeSavedWithEnabledServiceWhenNoDocumentsExistButServiceIsAlreadyEnabled |
( |
| ) |
|
Definition at line 210 of file ilTermsOfServiceSettingsFormGUITest.php.
References $_POST, $form, Sabre\Event\once(), and arConnectorMap\register().
212 $tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
215 ->expects($this->any())
216 ->method(
'getStatus')
220 ->expects($this->
once())
221 ->method(
'saveStatus');
223 $form = $this->getMockBuilder(\ilTermsOfServiceSettingsFormGUI::class)
224 ->setConstructorArgs([
228 ->setMethods([
'checkInput',
'getInput'])
232 ->expects($this->
once())
233 ->method(
'checkInput')
237 ->expects($this->exactly(2))
245 $form->setCheckInputCalled(
true);
247 $documentConnector = $this->getMockBuilder(\arConnector::class)->getMock();#
250 ->expects($this->
once())
251 ->method(
'affectedRows')
256 $this->assertTrue(
$form->saveObject());
257 $this->assertFalse(
$form->hasTranslatedError());
258 $this->assertEmpty(
$form->getTranslatedError());
static register(ActiveRecord $ar, arConnector $connector)
if(isset($_POST['submit'])) $form
Class ilTermsOfServiceDocument.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
◆ testFormCannotBeSavedWithEnabledServiceWhenNoDocumentsExistAndServiceIsCurrentlyDisabled()
ilTermsOfServiceSettingsFormGUITest::testFormCannotBeSavedWithEnabledServiceWhenNoDocumentsExistAndServiceIsCurrentlyDisabled |
( |
| ) |
|
Definition at line 147 of file ilTermsOfServiceSettingsFormGUITest.php.
References $_POST, $form, $lng, ilTermsOfServiceBaseTest\getLanguageMock(), Sabre\Event\once(), arConnectorMap\register(), and ilTermsOfServiceBaseTest\setGlobalVariable().
152 ->expects($this->any())
154 ->willReturn(
'translation');
158 $tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
161 ->expects($this->any())
162 ->method(
'getStatus')
166 ->expects($this->never())
167 ->method(
'saveStatus');
169 $form = $this->getMockBuilder(\ilTermsOfServiceSettingsFormGUI::class)
170 ->setConstructorArgs([
174 ->setMethods([
'checkInput',
'getInput'])
178 ->expects($this->
once())
179 ->method(
'checkInput')
183 ->expects($this->
once())
191 $form->setCheckInputCalled(
true);
193 $documentConnector = $this->getMockBuilder(\arConnector::class)->getMock();#
196 ->expects($this->
once())
197 ->method(
'affectedRows')
202 $this->assertFalse(
$form->saveObject());
203 $this->assertTrue(
$form->hasTranslatedError());
204 $this->assertNotEmpty(
$form->getTranslatedError());
setGlobalVariable(string $name, $value)
static register(ActiveRecord $ar, arConnector $connector)
if(isset($_POST['submit'])) $form
Class ilTermsOfServiceDocument.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
The documentation for this class was generated from the following file: