chore: initial import for test contour
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Service;
|
||||
|
||||
use App\Service\Crypt\AESCryptService;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AESCryptServiceTest extends TestCase
|
||||
{
|
||||
private AESCryptService $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$secret = $_ENV['AES_SECRET_KEY'];
|
||||
$cipher = $_ENV['AES_CIPHER_METHOD'];
|
||||
|
||||
$this->service = new AESCryptService($secret, $cipher);
|
||||
}
|
||||
|
||||
public function testEncryptDecrypt(): void
|
||||
{
|
||||
$plaintext = 'Hello, world!';
|
||||
$encrypted = $this->service->encrypt($plaintext);
|
||||
$decrypted = $this->service->decrypt($encrypted);
|
||||
|
||||
$this->assertNotEquals($plaintext, $encrypted);
|
||||
$this->assertEquals($plaintext, $decrypted);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user