Completed
Branch v1.x-dev (5736e4)
by Benjamin
04:09
created

RuleHelperExceptionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
c 0
b 0
f 0
dl 0
loc 33
rs 10
wmc 3
1
<?php
2
3
namespace Obblm\Core\Tests\Helper;
4
5
use Obblm\Core\Entity\Rule;
6
use Obblm\Core\Helper\RuleHelper;
7
use Symfony\Bundle\FrameworkBundle\Console\Application;
8
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
9
10
class RuleHelperExceptionTest extends KernelTestCase
11
{
12
    const REAL_RULE_PATH = '/../Resources/datas/rules/';
13
    protected $application;
14
    protected $ruleHelper;
15
    protected $realRule;
16
17
    protected function setUp(): void
18
    {
19
        self::bootKernel();
20
        $this->application = new Application(self::$kernel);
21
        $this->ruleHelper = self::$kernel->getContainer()->get(RuleHelper::class);
22
    }
23
24
    public function testExceptionGetter(): void
25
    {
26
        $dummyRule = (new Rule())
27
            ->setRuleKey('testRule')
28
            ->setTemplate('testRule')
29
        ;
30
        $this->expectException(\Exception::class);
31
        $this->ruleHelper->addRule($dummyRule);
32
        $this->ruleHelper->getHelper($dummyRule);
33
        $this->expectException('');
34
    }
35
36
    protected function tearDown(): void
37
    {
38
        parent::tearDown();
39
40
        // doing this is recommended to avoid memory leaks
41
        $this->application = null;
42
        $this->ruleHelper = null;
43
    }
44
}
45