Move to Symfony Flex

The structure changed completely.
Bundles are gone. Everything is flatten in the folder `src`.
I separated import & api controllers to avoid _pollution_ in the main controller folder.
This commit is contained in:
Jeremy Benoist
2022-12-20 22:36:02 +01:00
parent 911e0238b7
commit 6b5a518ce2
629 changed files with 7238 additions and 2194 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace App\Tests\Helper;
use App\Helper\CryptoProxy;
use Monolog\Handler\TestHandler;
use Monolog\Logger;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
class CryptoProxyTest extends TestCase
{
public function testCrypto()
{
$logHandler = new TestHandler();
$logger = new Logger('test', [$logHandler]);
$crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', $logger);
$crypted = $crypto->crypt('test');
$decrypted = $crypto->decrypt($crypted);
$this->assertSame('test', $decrypted);
$records = $logHandler->getRecords();
$this->assertCount(2, $records);
$this->assertStringContainsString('Crypto: crypting value', $records[0]['message']);
$this->assertStringContainsString('Crypto: decrypting value', $records[1]['message']);
}
public function testDecryptBadValue()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Decrypt fail');
$crypto = new CryptoProxy(sys_get_temp_dir() . '/' . uniqid('', true) . '.txt', new NullLogger());
$crypto->decrypt('badvalue');
}
}