ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
MapValuesTest Class Reference
+ Inheritance diagram for MapValuesTest:
+ Collaboration diagram for MapValuesTest:

Public Member Functions

 testTransform ()
 
 testTransformFails ()
 

Data Fields

array B
 

Protected Member Functions

 setUp ()
 

Private Attributes

array $test_array
 
array $result_array
 
Refinery $f
 
Transformation $map_values
 

Detailed Description

Definition at line 26 of file MapValuesTest.php.

Member Function Documentation

◆ setUp()

MapValuesTest::setUp ( )
protected

Definition at line 43 of file MapValuesTest.php.

43  : void
44  {
45  $dataFactory = new DataFactory();
46  $language = $this->createMock(ILIAS\Language\Language::class);
47 
48  $this->f = new Refinery($dataFactory, $language);
49  $this->map_values = $this->f->container()->mapValues($this->f->custom()->transformation(fn($v) => $v * 2));
50  }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testTransform()

MapValuesTest::testTransform ( )

Definition at line 52 of file MapValuesTest.php.

52  : void
53  {
54  $result = $this->map_values->transform($this->test_array);
55  $this->assertEquals($this->result_array, $result);
56  $this->assertEquals(["A", "B", "C"], array_keys($result));
57  }

◆ testTransformFails()

MapValuesTest::testTransformFails ( )

Definition at line 59 of file MapValuesTest.php.

References null.

59  : void
60  {
61  $this->expectException(InvalidArgumentException::class);
62  $this->map_values->transform(null);
63  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Field Documentation

◆ $f

Refinery MapValuesTest::$f
private

Definition at line 40 of file MapValuesTest.php.

◆ $map_values

Transformation MapValuesTest::$map_values
private

Definition at line 41 of file MapValuesTest.php.

◆ $result_array

array MapValuesTest::$result_array
private
Initial value:
= [
"A" => 520

Definition at line 35 of file MapValuesTest.php.

◆ $test_array

array MapValuesTest::$test_array
private
Initial value:
= [
"A" => 260

Definition at line 29 of file MapValuesTest.php.

◆ B

array MapValuesTest::B
Initial value:
=> 22,
"C" => 4010
]

Definition at line 31 of file MapValuesTest.php.


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