| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 18 | abstract class AbstractTestCase extends AbstractTest |
||
| 19 | { |
||
| 20 | use MockeryPHPUnitIntegration; |
||
| 21 | |||
| 22 | protected function setUp(): void |
||
| 23 | { |
||
| 24 | parent::setUp(); |
||
| 25 | ModelLocator::instance()->getModelRegistry()->setItems([]); |
||
| 26 | PaymentsModels::reset(); |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function initUtilityModel($type, $value = null) |
||
| 30 | { |
||
| 31 | if ($value instanceof RecordManager) { |
||
| 32 | ModelLocator::set($type, $value); |
||
| 33 | } else { |
||
| 34 | $class = $this->generateRepositoryClass($type); |
||
| 35 | $value = new $class(); |
||
| 36 | |||
| 37 | ModelLocator::set($class, $value); |
||
| 38 | ModelLocator::set($type, $value); |
||
| 39 | } |
||
| 40 | return $value; |
||
| 41 | } |
||
| 42 | |||
| 43 | protected function generateRepositoryClass($type) |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } |
||
| 55 |