| Total Complexity | 3 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | final class LayerTest |
||
| 10 | { |
||
| 11 | private const DOMAIN_NAMESPACE = 'DaveLiddament\StaticAnalysisResultsBaseliner\Domain'; |
||
| 12 | private const PLUGIN_NAMESPACE = 'DaveLiddament\StaticAnalysisResultsBaseliner\Plugins'; |
||
| 13 | private const LEGACY_NAMESPACE = 'DaveLiddament\StaticAnalysisResultsBaseliner\Legacy'; |
||
| 14 | private const FRAMEWORK_NAMESPACE = 'DaveLiddament\StaticAnalysisResultsBaseliner\Framework'; |
||
| 15 | |||
| 16 | public function testDomainDoesNotDependOnOtherLayers(): Rule |
||
| 17 | { |
||
| 18 | return PHPat::rule() |
||
| 19 | ->classes(Selector::inNamespace(self::DOMAIN_NAMESPACE)) |
||
| 20 | ->shouldNotDependOn() |
||
| 21 | ->classes( |
||
| 22 | Selector::inNamespace(self::PLUGIN_NAMESPACE), |
||
| 23 | Selector::inNamespace(self::LEGACY_NAMESPACE), |
||
| 24 | Selector::inNamespace(self::FRAMEWORK_NAMESPACE), |
||
| 25 | )->because('Domain code should not depend on any other code') |
||
| 26 | ; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testsPluginDoesNotDependOnFrameworkLayer(): Rule |
||
| 30 | { |
||
| 31 | return PHPat::rule() |
||
| 32 | ->classes(Selector::inNamespace(self::PLUGIN_NAMESPACE)) |
||
| 33 | ->shouldNotDependOn() |
||
| 34 | ->classes( |
||
| 35 | Selector::inNamespace(self::FRAMEWORK_NAMESPACE), |
||
| 36 | Selector::inNamespace(self::LEGACY_NAMESPACE), |
||
| 37 | )->because('Plugin code should not depend on framework or legacy code') |
||
| 38 | ; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testsLegacyDoesNotDependOnFrameworkLayer(): Rule |
||
| 49 | ; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |