ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ValueTest.php
Go to the documentation of this file.
1 <?php
2 
30 
31 require_once("vendor/composer/vendor/autoload.php");
32 
39 #[BackupGlobals(false)]
40 #[BackupStaticProperties(false)]
41 #[PreserveGlobalState(false)]
42 #[RunTestsInSeparateProcesses]
43 class ValueTest extends TestCase
44 {
45  public function testIntegerValue(): void
46  {
47  $integer = new IntegerValue();
48  $integer->setValue(3);
49  $integer2 = new IntegerValue(3);
50  $integer2->setValue(3);
51  $integer3 = new IntegerValue(4);
52  $integer3->setValue(4);
53 
54  $this->assertEquals($integer->getValue(), 3);
55  $this->assertTrue($integer->equals($integer2));
56  $this->assertEquals($integer->getHash(), $integer2->getHash());
57  $this->assertNotEquals($integer->getHash(), $integer3->getHash());
58  $integer3->unserialize($integer->serialize());
59  $this->assertTrue($integer->equals($integer3));
60  $this->assertTrue($integer->getType()->equals(new SingleType(IntegerValue::class)));
61  }
62 
63  public function testListValue(): void
64  {
65  $list = new ListValue();
66  $list->setValue([1, 2, 3]);
67 
68  $this->assertTrue($list->getType()->equals(new ListType(IntegerValue::class)));
69 
70  $list2 = new ListValue();
71  $integer1 = new IntegerValue();
72  $integer1->setValue(1);
73  $string = new StringValue();
74  $string->setValue("1");
75  $list2->setValue([$integer1, $string]);
76 
77  $this->assertTrue($list2->getType()->equals(new ListType(ScalarValue::class)));
78  }
79 }
testIntegerValue()
Definition: ValueTest.php:45
testListValue()
Definition: ValueTest.php:63
Class BackgroundTaskTest.
Definition: ValueTest.php:43