From ae532546d6bfa3a2bd603cb69cab554cf6398f3c Mon Sep 17 00:00:00 2001 From: Enea Date: Mon, 29 Jul 2024 17:56:16 +0200 Subject: [PATCH] more tests for ArrayAccess --- src/ArrayObjectTrait.php | 1 + src/ConfigInterface.php | 2 +- tests/unit/ConfigTest.php | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ArrayObjectTrait.php b/src/ArrayObjectTrait.php index 681f48b..b021cb5 100644 --- a/src/ArrayObjectTrait.php +++ b/src/ArrayObjectTrait.php @@ -26,6 +26,7 @@ public function offsetExists($index): bool */ public function offsetGet($index) { + codecept_debug($index); return $this->get($index); } diff --git a/src/ConfigInterface.php b/src/ConfigInterface.php index 8d96b84..bd0bb85 100644 --- a/src/ConfigInterface.php +++ b/src/ConfigInterface.php @@ -17,7 +17,7 @@ interface ConfigInterface extends Config_Interface, StoreInterface, \ArrayAccess /** * Determine if the given configuration value exists. * - * @param TKey|string $key + * @param TKey $key * @return bool */ public function has($key): bool; diff --git a/tests/unit/ConfigTest.php b/tests/unit/ConfigTest.php index d6e33cc..bc74aed 100644 --- a/tests/unit/ConfigTest.php +++ b/tests/unit/ConfigTest.php @@ -705,7 +705,8 @@ public function testSubArrayAccess(): void $this->assertSame('value', $sut->get('key.sub-key')); $this->assertSame('value', $sut['key.sub-key']); $this->assertSame('value', $sut['key']['sub-key']); -// $this->assertSame(null, $sut['key']['not-exists']); + $this->assertSame(false, isset($sut['key']['not-exists'])); + $this->assertSame(false, $sut['key']['not-exists'] ?? false); $this->assertSame(null, $sut['key.not-exists']); $this->assertSame(null, $sut['key.not-exists.not-exists']); }