File tree Expand file tree Collapse file tree
tests/system/Encryption/Handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818use CodeIgniter \Test \CIUnitTestCase ;
1919use Config \Encryption as EncryptionConfig ;
2020use PHPUnit \Framework \Attributes \Group ;
21+ use ReflectionProperty ;
2122use SodiumException ;
2223
2324/**
@@ -164,13 +165,15 @@ public function testBug0IssetThrowsTypeError(): void
164165
165166 public function testBug1MemzeroZeroesInternalKey (): void
166167 {
167- /** @var SodiumHandler $encrypter */
168- $ encrypter = $ this ->encryption ->initialize ($ this ->config );
169- $ originalKey = $ encrypter ->key ; // @phpstan-ignore-line
168+ $ encrypter = $ this ->encryption ->initialize ($ this ->config );
169+
170+ $ refKey = new ReflectionProperty ($ encrypter , 'key ' );
171+
172+ $ originalKey = $ refKey ->getValue ($ encrypter );
170173
171174 $ encrypter ->encrypt ('message ' );
172175
173- $ this ->assertSame ($ originalKey , $ encrypter -> key ); // @phpstan-ignore-line
176+ $ this ->assertSame ($ originalKey , $ refKey -> getValue ( $ encrypter ));
174177 }
175178
176179 public function testBug2InvalidKeyLengthThrowsSodiumException (): void
You can’t perform that action at this time.
0 commit comments