forked from absolute-quantum/DoctrineEncryptBundle
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDoctrineEncryptExtensionTest.php
More file actions
65 lines (51 loc) · 1.88 KB
/
Copy pathDoctrineEncryptExtensionTest.php
File metadata and controls
65 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Ambta\DoctrineEncryptBundle\Tests\Unit\DependencyInjection;
use Ambta\DoctrineEncryptBundle\DependencyInjection\DoctrineEncryptExtension;
use Ambta\DoctrineEncryptBundle\Encryptors\DefuseEncryptor;
use Ambta\DoctrineEncryptBundle\Encryptors\HaliteEncryptor;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
class DoctrineEncryptExtensionTest extends TestCase
{
/**
* @var DoctrineEncryptExtension
*/
private $extension;
protected function setUp(): void
{
$this->extension = new DoctrineEncryptExtension();
}
public function testConfigLoadHalite(): void
{
$container = $this->createContainer();
$this->extension->load([[]], $container);
$this->assertSame(HaliteEncryptor::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name'));
}
public function testConfigLoadDefuse(): void
{
$container = $this->createContainer();
$config = [
'encryptor_class' => 'Defuse',
];
$this->extension->load([$config], $container);
$this->assertSame(DefuseEncryptor::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name'));
}
public function testConfigLoadCustom(): void
{
$container = $this->createContainer();
$config = [
'encryptor_class' => self::class,
];
$this->extension->load([$config], $container);
$this->markTestSkipped();
$this->assertSame(self::class, $container->getParameter('ambta_doctrine_encrypt.encryptor_class_name'));
}
private function createContainer(): ContainerBuilder
{
$container = new ContainerBuilder(
new ParameterBag(['kernel.debug' => false])
);
return $container;
}
}