ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Data\Description\FactoryTest Class Reference
+ Inheritance diagram for ILIAS\Data\Description\FactoryTest:
+ Collaboration diagram for ILIAS\Data\Description\FactoryTest:

Public Member Functions

 setUp ()
 
 testInt ()
 
 testFloat ()
 
 testString ()
 
 testDateTime ()
 
 testBool ()
 
 testNull ()
 
 testList ()
 
 testMap ()
 
 testObject ()
 

Protected Attributes

Factory $f
 
ILIAS Data Text SimpleDocumentMarkdown $md
 

Detailed Description

Definition at line 36 of file FactoryTest.php.

Member Function Documentation

◆ setUp()

ILIAS\Data\Description\FactoryTest::setUp ( )

Definition at line 41 of file FactoryTest.php.

41 : void
42 {
43 $this->f = new Factory();
44 $this->md = $this->createMock(\ILIAS\Data\Text\SimpleDocumentMarkdown::class);
45 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

◆ testBool()

ILIAS\Data\Description\FactoryTest::testBool ( )

Definition at line 83 of file FactoryTest.php.

83 : void
84 {
85 $value = $this->f->bool($this->md);
86
87 $this->assertInstanceOf(Description::class, $value);
88 $this->assertInstanceOf(DValue::class, $value);
89 $this->assertEquals(ValueType::BOOL, $value->getType());
90 }

◆ testDateTime()

ILIAS\Data\Description\FactoryTest::testDateTime ( )

Definition at line 74 of file FactoryTest.php.

74 : void
75 {
76 $value = $this->f->datetime($this->md);
77
78 $this->assertInstanceOf(Description::class, $value);
79 $this->assertInstanceOf(DValue::class, $value);
80 $this->assertEquals(ValueType::DATETIME, $value->getType());
81 }

◆ testFloat()

ILIAS\Data\Description\FactoryTest::testFloat ( )

Definition at line 56 of file FactoryTest.php.

56 : void
57 {
58 $value = $this->f->float($this->md);
59
60 $this->assertInstanceOf(Description::class, $value);
61 $this->assertInstanceOf(DValue::class, $value);
62 $this->assertEquals(ValueType::FLOAT, $value->getType());
63 }

◆ testInt()

ILIAS\Data\Description\FactoryTest::testInt ( )

Definition at line 47 of file FactoryTest.php.

47 : void
48 {
49 $value = $this->f->int($this->md);
50
51 $this->assertInstanceOf(Description::class, $value);
52 $this->assertInstanceOf(DValue::class, $value);
53 $this->assertEquals(ValueType::INT, $value->getType());
54 }

◆ testList()

ILIAS\Data\Description\FactoryTest::testList ( )

Definition at line 101 of file FactoryTest.php.

101 : void
102 {
103 $value = $this->f->string($this->md);
104 $list = $this->f->list($this->md, $value);
105
106 $this->assertInstanceOf(Description::class, $list);
107 $this->assertInstanceOf(DList::class, $list);
108 $this->assertEquals($value, $list->getValueType());
109 }

◆ testMap()

ILIAS\Data\Description\FactoryTest::testMap ( )

Definition at line 111 of file FactoryTest.php.

111 : void
112 {
113 $key = $this->f->string($this->md);
114 $value = $this->f->string($this->md);
115 $map = $this->f->map($this->md, $key, $value);
116
117 $this->assertInstanceOf(Description::class, $map);
118 $this->assertInstanceOf(DMap::class, $map);
119 $this->assertEquals($key, $map->getKeyType());
120 $this->assertEquals($value, $map->getValueType());
121 }

◆ testNull()

ILIAS\Data\Description\FactoryTest::testNull ( )

Definition at line 92 of file FactoryTest.php.

92 : void
93 {
94 $value = $this->f->null($this->md);
95
96 $this->assertInstanceOf(Description::class, $value);
97 $this->assertInstanceOf(DValue::class, $value);
98 $this->assertEquals(ValueType::NULL, $value->getType());
99 }

References ILIAS\Data\Description\NULL.

◆ testObject()

ILIAS\Data\Description\FactoryTest::testObject ( )

Definition at line 123 of file FactoryTest.php.

123 : void
124 {
125 $f1_type = $this->f->int($this->md);
126 $f1_name = "field1";
127 $f2_type = $this->f->float($this->md);
128 $f2_name = "field2";
129 $object = $this->f->object($this->md, [$f1_name => $f1_type, $f2_name => $f2_type]);
130
131 $this->assertInstanceOf(Description::class, $object);
132 $this->assertInstanceOf(DObject::class, $object);
133 [$f1, $f2] = iterator_to_array($object->getFields());
134 $this->assertEquals($f1_name, $f1->getName());
135 $this->assertEquals($f1_type, $f1->getType());
136 $this->assertEquals($f2_name, $f2->getName());
137 $this->assertEquals($f2_type, $f2->getType());
138 }

◆ testString()

ILIAS\Data\Description\FactoryTest::testString ( )

Definition at line 65 of file FactoryTest.php.

65 : void
66 {
67 $value = $this->f->string($this->md);
68
69 $this->assertInstanceOf(Description::class, $value);
70 $this->assertInstanceOf(DValue::class, $value);
71 $this->assertEquals(ValueType::STRING, $value->getType());
72 }

Field Documentation

◆ $f

Factory ILIAS\Data\Description\FactoryTest::$f
protected

Definition at line 38 of file FactoryTest.php.

◆ $md

ILIAS Data Text SimpleDocumentMarkdown ILIAS\Data\Description\FactoryTest::$md
protected

Definition at line 39 of file FactoryTest.php.


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