Skip to content

Commit c29fbc0

Browse files
committed
test: resolve ReflectionException
1 parent fee9dd0 commit c29fbc0

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

tests/system/Encryption/Handlers/SodiumHandlerTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use CodeIgniter\Test\CIUnitTestCase;
1919
use Config\Encryption as EncryptionConfig;
2020
use PHPUnit\Framework\Attributes\Group;
21-
use ReflectionProperty;
2221
use SodiumException;
2322

2423
/**
@@ -167,13 +166,12 @@ public function testBug1MemzeroZeroesInternalKey(): void
167166
{
168167
$encrypter = $this->encryption->initialize($this->config);
169168

170-
$refKey = new ReflectionProperty($encrypter, 'key');
171-
172-
$originalKey = $refKey->getValue($encrypter);
169+
$prop = 'key';
170+
$originalKey = $encrypter->{$prop}; // @phpstan-ignore property.notFound
173171

174172
$encrypter->encrypt('message');
175173

176-
$this->assertSame($originalKey, $refKey->getValue($encrypter));
174+
$this->assertSame($originalKey, $encrypter->{$prop}); // @phpstan-ignore property.notFound
177175
}
178176

179177
public function testBug2InvalidKeyLengthThrowsSodiumException(): void

0 commit comments

Comments
 (0)