ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\Data\Description\DDValueTest Class Reference
+ Inheritance diagram for ILIAS\Data\Description\DDValueTest:
+ Collaboration diagram for ILIAS\Data\Description\DDValueTest:

Public Member Functions

 testIntRepresentation (ValueType $type, $value, $is_match)
 casesProvider More...
 

Static Public Member Functions

static casesProvider ()
 

Detailed Description

Definition at line 31 of file DValueTest.php.

Member Function Documentation

◆ casesProvider()

static ILIAS\Data\Description\DDValueTest::casesProvider ( )
static

Definition at line 55 of file DValueTest.php.

References ILIAS\Data\Description\NULL, and null.

55  : array
56  {
57  return [
58  [ValueType::INT, 42, true],
59  [ValueType::INT, "foo", false],
60  [ValueType::FLOAT, 2.3, true],
61  [ValueType::FLOAT, "foo", false],
62  [ValueType::STRING, "foo", true],
63  [ValueType::STRING, 2, false],
64  [ValueType::DATETIME, new \DateTimeImmutable(), true],
65  [ValueType::DATETIME, "foo", false],
66  [ValueType::BOOL, true, true],
67  [ValueType::BOOL, false, true],
68  [ValueType::BOOL, "true", false],
69  [ValueType::BOOL, 1, false],
70  [ValueType::BOOL, null, false],
71  [ValueType::NULL, null, true],
72  [ValueType::NULL, false, false],
73  ];
74  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testIntRepresentation()

ILIAS\Data\Description\DDValueTest::testIntRepresentation ( ValueType  $type,
  $value,
  $is_match 
)

casesProvider

Definition at line 36 of file DValueTest.php.

References $res.

36  : void
37  {
38  $desc = new DValue(
39  $this->createMock(\ILIAS\Data\Text\SimpleDocumentMarkdown::class),
40  $type
41  );
42 
43  $res = $desc->getPrimitiveRepresentation($value);
44 
45  if ($is_match) {
46  $this->assertEquals($value, $res);
47  } else {
48  $this->assertInstanceOf(\Closure::class, $res);
49  $errors = iterator_to_array($res());
50  $this->assertCount(1, $errors);
51  $this->assertTrue(is_string($errors[0]));
52  }
53  }
$res
Definition: ltiservices.php:66
Interface Observer Contains several chained tasks and infos about them.

The documentation for this class was generated from the following file: