Skip to content

Commit bc39921

Browse files
authored
Merge pull request #832 from patchlevel/phpat-layer
Add layer tests with `phpat` based on `deptrac` layers, remove `deptrac`
2 parents 9d23680 + a079d3a commit bc39921

10 files changed

Lines changed: 538 additions & 1401 deletions

File tree

.github/workflows/deptrac.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ infection.log
88
.phpbench/
99
infection.html
1010
*.sqlite3
11-
.deptrac.cache
1211
docs_php/
1312
docs/.cache

Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ infection: vendor
5151
infection-diff: vendor ## run infection on differences
5252
php -d memory_limit=312M vendor/bin/infection --threads=max --git-diff-lines --git-diff-base=origin/HEAD --ignore-msi-with-no-mutations --only-covered --min-msi=80 --min-covered-msi=95
5353

54-
.PHONY: deptrac
55-
deptrac: vendor-tools ## run deptrac
56-
cd tools && ./vendor/bin/deptrac -c ../deptrac.yaml
57-
58-
.PHONY: deptrac-baseline
59-
deptrac-baseline: vendor-tools ## run deptrac and update baseline
60-
cd tools && ./vendor/bin/deptrac -c ../deptrac.yaml --formatter=baseline --output=../deptrac-baseline.yaml
61-
6254
.PHONY: static
6355
static: phpstan cs ## run static analyser
6456

deptrac-baseline.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

deptrac.yaml

Lines changed: 0 additions & 194 deletions
This file was deleted.

phpstan-baseline.neon

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: '#^Patchlevel\\EventSourcing\\Aggregate\\AggregateRootId should not depend on Patchlevel\\EventSourcing\\Serializer\\Normalizer\\IdNormalizer$#'
5+
identifier: phpat.testAggregateCanOnlyDependOnAllowedLayers
6+
count: 1
7+
path: src/Aggregate/AggregateRootId.php
8+
9+
-
10+
message: '#^Patchlevel\\EventSourcing\\Attribute\\Processor should not depend on Patchlevel\\EventSourcing\\Subscription\\RunMode$#'
11+
identifier: phpat.testAttributeCanOnlyDependOnAllowedLayers
12+
count: 2
13+
path: src/Attribute/Processor.php
14+
15+
-
16+
message: '#^Patchlevel\\EventSourcing\\Attribute\\Projector should not depend on Patchlevel\\EventSourcing\\Subscription\\RunMode$#'
17+
identifier: phpat.testAttributeCanOnlyDependOnAllowedLayers
18+
count: 2
19+
path: src/Attribute/Projector.php
20+
21+
-
22+
message: '#^Patchlevel\\EventSourcing\\Attribute\\SharedApplyContext should not depend on Patchlevel\\EventSourcing\\Aggregate\\AggregateRoot$#'
23+
identifier: phpat.testAttributeCanOnlyDependOnAllowedLayers
24+
count: 1
25+
path: src/Attribute/SharedApplyContext.php
26+
27+
-
28+
message: '#^Patchlevel\\EventSourcing\\Attribute\\Subscriber should not depend on Patchlevel\\EventSourcing\\Subscription\\RunMode$#'
29+
identifier: phpat.testAttributeCanOnlyDependOnAllowedLayers
30+
count: 1
31+
path: src/Attribute/Subscriber.php
32+
333
-
434
message: '#^Cannot unset offset ''url'' on array\{application_name\?\: string, charset\?\: string, defaultTableOptions\?\: array\<string, mixed\>, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\<Doctrine\\DBAL\\Driver\>, driverOptions\?\: array\<mixed\>, host\?\: string, keepReplica\?\: bool, \.\.\.\}\.$#'
535
identifier: unset.offset
@@ -96,6 +126,12 @@ parameters:
96126
count: 1
97127
path: src/Store/Criteria/StreamCriterion.php
98128

129+
-
130+
message: '#^Patchlevel\\EventSourcing\\Store\\DoctrineDbalStore should not depend on Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader$#'
131+
identifier: phpat.testStoreCanOnlyDependOnAllowedLayers
132+
count: 2
133+
path: src/Store/DoctrineDbalStore.php
134+
99135
-
100136
message: '#^Method Patchlevel\\EventSourcing\\Store\\DoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#'
101137
identifier: return.unusedType
@@ -114,12 +150,36 @@ parameters:
114150
count: 1
115151
path: src/Store/DoctrineDbalStoreStream.php
116152

153+
-
154+
message: '#^Patchlevel\\EventSourcing\\Store\\DoctrineDbalStoreStream should not depend on Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader$#'
155+
identifier: phpat.testStoreCanOnlyDependOnAllowedLayers
156+
count: 1
157+
path: src/Store/DoctrineDbalStoreStream.php
158+
117159
-
118160
message: '#^Ternary operator condition is always true\.$#'
119161
identifier: ternary.alwaysTrue
120162
count: 1
121163
path: src/Store/DoctrineDbalStoreStream.php
122164

165+
-
166+
message: '#^Patchlevel\\EventSourcing\\Store\\InMemoryStore should not depend on Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader$#'
167+
identifier: phpat.testStoreCanOnlyDependOnAllowedLayers
168+
count: 5
169+
path: src/Store/InMemoryStore.php
170+
171+
-
172+
message: '#^Patchlevel\\EventSourcing\\Store\\InMemoryStore should not depend on Patchlevel\\EventSourcing\\Metadata\\Event\\EventRegistry$#'
173+
identifier: phpat.testStoreCanOnlyDependOnAllowedLayers
174+
count: 1
175+
path: src/Store/InMemoryStore.php
176+
177+
-
178+
message: '#^Patchlevel\\EventSourcing\\Store\\MissingEventRegistry should not depend on Patchlevel\\EventSourcing\\Metadata\\Event\\EventRegistry$#'
179+
identifier: phpat.testStoreCanOnlyDependOnAllowedLayers
180+
count: 1
181+
path: src/Store/MissingEventRegistry.php
182+
123183
-
124184
message: '#^Method Patchlevel\\EventSourcing\\Store\\StreamDoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#'
125185
identifier: return.unusedType

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ services:
1818
class: Patchlevel\EventSourcing\Tests\Architecture\FinalClassesTest
1919
tags:
2020
- phpat.test
21+
22+
-
23+
class: Patchlevel\EventSourcing\Tests\Architecture\LayerDependenciesTest
24+
tags:
25+
- phpat.test

0 commit comments

Comments
 (0)