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 
5 require_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  "",
25  $options,
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  "",
43  $options,
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  "",
58  $options,
59  ""
60  ))->withRequired(true);
61 
62  $this->assertTrue($select->_isClientSideValueOk(""));
63  }
64 }
testEmptyStringIsNoAcceptableClientSideValueIfSelectIsRequired()
Definition: SelectTest.php:50
Class BaseForm.
This describes select field.
Definition: Select.php:10
testOnlyValuesFromOptionsAreAcceptableClientSideValues()
Definition: SelectTest.php:17
Provides common functionality for UI tests.
Definition: Base.php:191
_isClientSideValueOk($value)
Definition: SelectTest.php:9
testEmptyStringIsAcceptableClientSideValueIfSelectIsNotRequired()
Definition: SelectTest.php:35
withRequired($is_required)
Get an input like this, but set the field to be required (or not).