ILIAS  release_8 Revision v8.23
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 27 of file MapValuesTest.php.

Member Function Documentation

◆ setUp()

MapValuesTest::setUp ( )
protected

Definition at line 44 of file MapValuesTest.php.

44  : void
45  {
46  $dataFactory = new DataFactory();
47  $language = $this->createMock(ilLanguage::class);
48 
49  $this->f = new Refinery($dataFactory, $language);
50  $this->map_values = $this->f->container()->mapValues($this->f->custom()->transformation(fn ($v) => $v * 2));
51  }

◆ testTransform()

MapValuesTest::testTransform ( )

Definition at line 53 of file MapValuesTest.php.

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

◆ testTransformFails()

MapValuesTest::testTransformFails ( )

Definition at line 60 of file MapValuesTest.php.

60  : void
61  {
62  $this->expectException(InvalidArgumentException::class);
63  $this->map_values->transform(null);
64  }

Field Documentation

◆ $f

Refinery MapValuesTest::$f
private

Definition at line 41 of file MapValuesTest.php.

◆ $map_values

Transformation MapValuesTest::$map_values
private

Definition at line 42 of file MapValuesTest.php.

◆ $result_array

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

Definition at line 36 of file MapValuesTest.php.

◆ $test_array

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

Definition at line 30 of file MapValuesTest.php.

◆ B

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

Definition at line 32 of file MapValuesTest.php.


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