StorageInterfaceSegregationTest
class StorageInterfaceSegregationTest extends TestCase (View source)
Guards the storage-interface split: that each consumer declares the narrowest type it needs, and that the narrow types stay narrow.
ParsedDataStorageManager was a single 22-method interface with one implementor, handed whole to every consumer — so a validator receiving a store for querying could call save() or load() on the committed cache, and a test double had to stub 22 methods.
These are structural assertions rather than behavioural ones, deliberately: the split's whole value is which methods are reachable from which type, and that is invisible to a behavioural test. The earlier per-entity query split ([W5]) was deleted precisely because nothing verified that it had client types, and it turned out to have none.
Constants
| private MUTATING |
The methods that must not be reachable from a read-only handle. |
Methods
No description
No description
No description
No description
No description
Both parsers only produce, so they must declare the writer — not the composite. This is the half of the split that has genuine client types.
No description
The writer must not carry persistence: filling a store and committing it are separate rights.
The composite must still cover every concern, since the generation scripts use all of them.
No description
Serialization/ must not name Storage\PhpDocStorage. Fourteen files there used to, while Storage\JsonParsedDataStorage names Serialization\EntitySerializerInterface — a cycle. Only SerializerHelperTrait ever called anything on it (getPhpDoc/setPhpDoc); the rest mentioned the class purely in type declarations, so the cycle bought nothing and cost a serializer unit test a real PhpDocStorage — file path, lazy loading, and a save() it must never call — to exercise a pure array transform.
The query contract must stay in Storage/, next to the only class that satisfies it. It sat in Parsers/ while nothing under Parsers/ referenced it — the framework's only Storage -> Parsers edge existed purely so Storage/ could import its own contract back.
The slice handed to serializers must stay a slice: no file lifecycle, no bulk access.
Details
testRunnerHandsOutOnlyTheReadInterface(string $method)
No description
static array
runnerAccessors()
No description
testTheReadInterfaceExposesNoMutatingMethod(string $method)
No description
static array
mutatingMethods()
No description
testTheReadInterfaceIsTheEightQueryMethods()
No description
testParsersDeclareOnlyTheWriter(string $parserClass, int $parameterIndex)
Both parsers only produce, so they must declare the writer — not the composite. This is the half of the split that has genuine client types.
static array
producers()
No description
testWriterDoesNotGrantPersistence()
The writer must not carry persistence: filling a store and committing it are separate rights.
testCompositeStillComposesEveryConcern()
The composite must still cover every concern, since the generation scripts use all of them.
testTheSoleImplementorStillSatisfiesTheComposite()
No description
testSerializationDoesNotDependOnStorage()
Serialization/ must not name Storage\PhpDocStorage. Fourteen files there used to, while Storage\JsonParsedDataStorage names Serialization\EntitySerializerInterface — a cycle. Only SerializerHelperTrait ever called anything on it (getPhpDoc/setPhpDoc); the rest mentioned the class purely in type declarations, so the cycle bought nothing and cost a serializer unit test a real PhpDocStorage — file path, lazy loading, and a save() it must never call — to exercise a pure array transform.
Asserted on source text rather than on reflection because the coupling this guards against is
a type declaration, and a ?PhpDocStorage $x = null parameter that nobody passes is
invisible to any runtime check.
testTheQueryContractLivesWithItsImplementor()
The query contract must stay in Storage/, next to the only class that satisfies it. It sat in Parsers/ while nothing under Parsers/ referenced it — the framework's only Storage -> Parsers edge existed purely so Storage/ could import its own contract back.
testThePhpDocSliceExposesNothingButOneReaderAndOneWriter()
The slice handed to serializers must stay a slice: no file lifecycle, no bulk access.