ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
EntryLockingStringMapTest.php
Go to the documentation of this file.
1
<?php
2
3
namespace
ILIAS\FileUpload\Collection
;
4
5
use
ILIAS\FileUpload\Collection\Exception\ElementAlreadyExistsException
;
6
use
ILIAS\FileUpload\Collection\Exception\NoSuchElementException
;
7
8
require_once
'./libs/composer/vendor/autoload.php'
;
9
20
class
EntryLockingStringMapTest
extends
\PHPUnit_Framework_TestCase
21
{
22
26
private
$subject
;
27
31
public
function
setUp
()
32
{
33
$this->subject =
new
EntryLockingStringMap
();
34
}
35
39
public
function
testPutValueWhichShouldSucceed
()
40
{
41
$key
=
"hello"
;
42
$value =
"world"
;
43
$this->subject->put(
$key
, $value);
44
$result
= $this->subject->toArray();
45
46
$this->assertArrayHasKey(
$key
,
$result
);
47
$this->assertEquals($value,
$result
[
$key
]);
48
}
49
53
public
function
testPutValueTwiceWhichShouldFail
()
54
{
55
$key
=
"hello"
;
56
$value =
"world"
;
57
58
$this->subject->put(
$key
, $value);
59
60
$this->setExpectedException(ElementAlreadyExistsException::class,
"Element $key can not be overwritten."
);
61
62
$this->subject->put(
$key
, $value);
63
}
64
68
public
function
testGetWhichShouldSucceed
()
69
{
70
$key
=
"hello"
;
71
$value =
"world"
;
72
73
$this->subject->put(
$key
, $value);
74
$result
= $this->subject->get(
$key
);
75
76
$this->assertEquals($value,
$result
);
77
}
78
82
public
function
testGetWithoutPutTheValueWhichShouldFail
()
83
{
84
$key
=
"hello"
;
85
86
$this->setExpectedException(NoSuchElementException::class,
"No meta data associated with key \"$key\"."
);
87
$this->subject->get(
$key
);
88
}
89
}
ILIAS\FileUpload\Collection
Definition:
EntryLockingStringMap.php:3
$result
$result
Definition:
CleanUpTest.php:463
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\setUp
setUp()
Definition:
EntryLockingStringMapTest.php:31
ElementAlreadyExistsException
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\$subject
$subject
Definition:
EntryLockingStringMapTest.php:26
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\testGetWithoutPutTheValueWhichShouldFail
testGetWithoutPutTheValueWhichShouldFail()
Definition:
EntryLockingStringMapTest.php:82
ILIAS\FileUpload\Collection\EntryLockingStringMap
Class EntryLockingStringMap.
Definition:
EntryLockingStringMap.php:21
PHPUnit_Framework_TestCase
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\testPutValueWhichShouldSucceed
testPutValueWhichShouldSucceed()
Definition:
EntryLockingStringMapTest.php:39
ILIAS\FileUpload\Collection\EntryLockingStringMapTest
Class EntryLockingStringMapTest.
Definition:
EntryLockingStringMapTest.php:20
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\testGetWhichShouldSucceed
testGetWhichShouldSucceed()
Definition:
EntryLockingStringMapTest.php:68
ILIAS\FileUpload\Collection\EntryLockingStringMapTest\testPutValueTwiceWhichShouldFail
testPutValueTwiceWhichShouldFail()
Definition:
EntryLockingStringMapTest.php:53
$key
$key
Definition:
croninfo.php:18
NoSuchElementException
tests
FileUpload
Collection
EntryLockingStringMapTest.php
Generated on Sat Jan 18 2025 19:01:43 for ILIAS by
1.8.13 (using
Doxyfile
)