ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ValueTest.php
Go to the documentation of this file.
1<?php
2
9use PHPUnit\Framework\TestCase;
10
11require_once("libs/composer/vendor/autoload.php");
12
23class ValueTest extends TestCase
24{
25 public function testIntegerValue()
26 {
27 $integer = new IntegerValue();
28 $integer->setValue(3);
29 $integer2 = new IntegerValue(3);
30 $integer2->setValue(3);
31 $integer3 = new IntegerValue(4);
32 $integer3->setValue(4);
33
34 $this->assertEquals($integer->getValue(), 3);
35 $this->assertTrue($integer->equals($integer2));
36 $this->assertEquals($integer->getHash(), $integer2->getHash());
37 $this->assertNotEquals($integer->getHash(), $integer3->getHash());
38 $integer3->unserialize($integer->serialize());
39 $this->assertTrue($integer->equals($integer3));
40 $this->assertTrue($integer->getType()->equals(new SingleType(IntegerValue::class)));
41 }
42
43 public function testListValue()
44 {
45 $list = new ListValue();
46 $list->setValue([1, 2, 3]);
47
48 $list2 = new ListValue();
49 $integer1 = new IntegerValue();
50 $integer1->setValue(1);
51 $string = new StringValue();
52 $string->setValue("1");
53 $list2->setValue([$integer1, $string]);
54
55 $this->assertTrue($list->getType()->equals(new ListType(IntegerValue::class)));
56 $this->assertTrue($list2->getType()->equals(new ListType(ScalarValue::class)));
57 }
58}
An exception for terminatinating execution or to throw for unit testing.
Class BackgroundTaskTest.
Definition: ValueTest.php:24
testListValue()
Definition: ValueTest.php:43
testIntegerValue()
Definition: ValueTest.php:25
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41