Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 | } |
||
45 |