Skip to content

Commit

Permalink
more tests for ArrayAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
overclokk committed Jul 29, 2024
1 parent 3c0d1f2 commit ae53254
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ArrayObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function offsetExists($index): bool
*/
public function offsetGet($index)
{
codecept_debug($index);

Check warning on line 29 in src/ArrayObjectTrait.php

View workflow job for this annotation

GitHub Actions / 🐘 Test on PHP 8.0

Escaped Mutant for Mutator "FunctionCallRemoval": --- Original +++ New @@ @@ */ public function offsetGet($index) { - codecept_debug($index); + return $this->get($index); } /**

Check warning on line 29 in src/ArrayObjectTrait.php

View workflow job for this annotation

GitHub Actions / 🐘 Test on PHP 8.1

Escaped Mutant for Mutator "FunctionCallRemoval": --- Original +++ New @@ @@ */ public function offsetGet($index) { - codecept_debug($index); + return $this->get($index); } /**
return $this->get($index);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down

0 comments on commit ae53254

Please sign in to comment.