ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SelectTest.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2018 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5require_once(__DIR__ . "/../../../Base.php");
6
8{
9 public function _isClientSideValueOk($value)
10 {
11 return $this->isClientSideValueOk($value);
12 }
13}
14
16{
18 {
19 $options = ["one" => "Eins", "two" => "Zwei", "three" => "Drei"];
20 $select = new SelectForTest(
21 $this->createMock(ILIAS\Data\Factory::class),
22 $this->createMock(ILIAS\Validation\Factory::class),
23 $this->createMock(ILIAS\Transformation\Factory::class),
24 "",
26 ""
27 );
28
29 $this->assertTrue($select->_isClientSideValueOk("one"));
30 $this->assertTrue($select->_isClientSideValueOk("two"));
31 $this->assertTrue($select->_isClientSideValueOk("three"));
32 $this->assertFalse($select->_isClientSideValueOk("four"));
33 }
34
36 {
37 $options = [];
38 $select = new SelectForTest(
39 $this->createMock(ILIAS\Data\Factory::class),
40 $this->createMock(ILIAS\Validation\Factory::class),
41 $this->createMock(ILIAS\Transformation\Factory::class),
42 "",
44 ""
45 );
46
47 $this->assertTrue($select->_isClientSideValueOk(""));
48 }
49
51 {
52 $options = [];
53 $select = (new SelectForTest(
54 $this->createMock(ILIAS\Data\Factory::class),
55 $this->createMock(ILIAS\Validation\Factory::class),
56 $this->createMock(ILIAS\Transformation\Factory::class),
57 "",
59 ""
60 ))->withRequired(true);
61
62 $this->assertTrue($select->_isClientSideValueOk(""));
63 }
64}
An exception for terminatinating execution or to throw for unit testing.
Provides common functionality for UI tests.
Definition: Base.php:192
_isClientSideValueOk($value)
Definition: SelectTest.php:9
testEmptyStringIsAcceptableClientSideValueIfSelectIsNotRequired()
Definition: SelectTest.php:35
testEmptyStringIsNoAcceptableClientSideValueIfSelectIsRequired()
Definition: SelectTest.php:50
testOnlyValuesFromOptionsAreAcceptableClientSideValues()
Definition: SelectTest.php:17
This describes select field.
Definition: Select.php:11
Class BaseForm.