Skip to content

Commit ed718c7

Browse files
add test for Encrypter (#51089)
1 parent b90eebc commit ed718c7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/Encryption/EncrypterTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@
1010

1111
class EncrypterTest extends TestCase
1212
{
13-
public function testEncryption()
13+
public function testEncryption(): void
1414
{
1515
$e = new Encrypter(str_repeat('a', 16));
1616
$encrypted = $e->encrypt('foo');
1717
$this->assertNotSame('foo', $encrypted);
1818
$this->assertSame('foo', $e->decrypt($encrypted));
19+
20+
$encrypted = $e->encrypt('');
21+
$this->assertSame('', $e->decrypt($encrypted));
22+
23+
$longString = str_repeat('a', 1000);
24+
$encrypted = $e->encrypt($longString);
25+
$this->assertSame($longString, $e->decrypt($encrypted));
26+
27+
$data = ['foo' => 'bar', 'baz' => 'qux'];
28+
$encryptedArray = $e->encrypt($data);
29+
$this->assertNotSame($data, $encryptedArray);
30+
$this->assertSame($data, $e->decrypt($encryptedArray));
1931
}
2032

2133
public function testRawStringEncryption()

0 commit comments

Comments
 (0)