Total Complexity | 6 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
16 | abstract class AbstractTestCase extends AbstractTest |
||
17 | { |
||
18 | use MockeryPHPUnitIntegration; |
||
19 | |||
20 | protected function setUp(): void |
||
21 | { |
||
22 | parent::setUp(); |
||
23 | ModelLocator::instance()->getModelRegistry()->setItems([]); |
||
24 | PaymentsModels::reset(); |
||
25 | } |
||
26 | |||
27 | protected function initUtilityModel($type, $value = null) |
||
28 | { |
||
29 | if ($value instanceof RecordManager) { |
||
30 | ModelLocator::set($type, $value); |
||
31 | } else { |
||
32 | $class = $this->generateRepositoryClass($type); |
||
33 | $value = call_user_func([$class, 'instance']); |
||
34 | |||
35 | ModelLocator::set($class, $value); |
||
36 | ModelLocator::set($type, $value); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | protected function generateRepositoryClass($type) |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |