ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\FileUpload\Collection\EntryLockingStringMapTest Class Reference

Class EntryLockingStringMapTest. More...

+ Inheritance diagram for ILIAS\FileUpload\Collection\EntryLockingStringMapTest:
+ Collaboration diagram for ILIAS\FileUpload\Collection\EntryLockingStringMapTest:

Public Member Functions

 setUp ()
 @setup More...
 
 testPutValueWhichShouldSucceed ()
 
 testPutValueTwiceWhichShouldFail ()
 
 testGetWhichShouldSucceed ()
 
 testGetWithoutPutTheValueWhichShouldFail ()
 

Private Attributes

EntryLockingStringMap $subject
 

Detailed Description

Member Function Documentation

◆ setUp()

ILIAS\FileUpload\Collection\EntryLockingStringMapTest::setUp ( )

@setup

Definition at line 51 of file EntryLockingStringMapTest.php.

51 : void
52 {
53 $this->subject = new EntryLockingStringMap();
54 }

◆ testGetWhichShouldSucceed()

ILIAS\FileUpload\Collection\EntryLockingStringMapTest::testGetWhichShouldSucceed ( )

Definition at line 83 of file EntryLockingStringMapTest.php.

83 : void
84 {
85 $key = "hello";
86 $value = "world";
87
88 $this->subject->put($key, $value);
89 $result = $this->subject->get($key);
90
91 $this->assertSame($value, $result);
92 }

◆ testGetWithoutPutTheValueWhichShouldFail()

ILIAS\FileUpload\Collection\EntryLockingStringMapTest::testGetWithoutPutTheValueWhichShouldFail ( )

Definition at line 95 of file EntryLockingStringMapTest.php.

95 : void
96 {
97 $key = "hello";
98
99 $this->expectException(NoSuchElementException::class);
100 $this->expectExceptionMessage("No meta data associated with key \"$key\".");
101 $this->subject->get($key);
102 }

◆ testPutValueTwiceWhichShouldFail()

ILIAS\FileUpload\Collection\EntryLockingStringMapTest::testPutValueTwiceWhichShouldFail ( )

Definition at line 69 of file EntryLockingStringMapTest.php.

69 : void
70 {
71 $key = "hello";
72 $value = "world";
73
74 $this->subject->put($key, $value);
75
76 $this->expectException(ElementAlreadyExistsException::class);
77 $this->expectExceptionMessage("Element $key can not be overwritten.");
78
79 $this->subject->put($key, $value);
80 }

◆ testPutValueWhichShouldSucceed()

ILIAS\FileUpload\Collection\EntryLockingStringMapTest::testPutValueWhichShouldSucceed ( )

Definition at line 57 of file EntryLockingStringMapTest.php.

57 : void
58 {
59 $key = "hello";
60 $value = "world";
61 $this->subject->put($key, $value);
62 $result = $this->subject->toArray();
63
64 $this->assertArrayHasKey($key, $result);
65 $this->assertEquals($value, $result[$key]);
66 }

Field Documentation

◆ $subject

EntryLockingStringMap ILIAS\FileUpload\Collection\EntryLockingStringMapTest::$subject
private

Definition at line 46 of file EntryLockingStringMapTest.php.


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