3 declare(strict_types=1);
34 $test_key =
'test_key_1';
36 $this->expectException(LogicException::class);
37 $this->expectExceptionMessage(
"'$test_key' is not contained in provided data.");
38 $input_data->get($test_key);
43 $test_key =
'test_key_1';
44 $expected_value =
'expected_value_1';
49 $input_data->getOr($test_key, $expected_value)
55 $test_key =
'test_key_1';
56 $expected_value =
'expected_value_1';
58 $test_key => $expected_value,
63 $input_data->get($test_key)
69 $test_key =
'test_key_1';
70 $expected_value =
'expected_value_1';
72 $test_key => $expected_value,
75 $this->assertNotNull($input_data->getOr($test_key, null));
78 $input_data->getOr($test_key, null)
86 $test_array = [
'key1' =>
'val1'];
88 $test_boolean =
false;
89 $test_string =
'test_string_1';
92 $this->assertFalse($input_data->getOr(
'', $test_boolean));
93 $this->assertEquals($test_integer, $input_data->getOr(
'', $test_integer));
94 $this->assertEquals($test_array, $input_data->getOr(
'', $test_array));
95 $this->assertEquals($test_string, $input_data->getOr(
'', $test_string));
96 $this->assertEquals($test_double, $input_data->getOr(
'', $test_double));