StubsInterfaceParserTest
class StubsInterfaceParserTest extends TestCase (View source)
Methods
No description
Pins both halves of parse()'s type contract. assertInstanceOf alone is weak here: it keeps
passing if the : PHPInterface declaration is dropped or widened, as long as the body still
happens to return the right thing. Asserting the declared return type catches the loosening
itself, which is the change that would silently let a different entity type escape.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
An unqualified parent resolves within the declaring namespace, per PHP's rule for
class-like names. Storing only the short name let ClassHierarchyResolver match
MongoDB\BSON\Persistable extends Serializable against the global \Serializable.
No description
The stored name stays short even when the source writes a qualified parent, so the resolver's short-name fallback still works for stubs whose qualified id does not exist.
No description
A use statement must win over the declaring namespace, otherwise an imported parent
is silently rewritten to a same-namespace name that does not exist.
No description
Importing a global interface is how a stub says "the root-namespace one" — the case
namespace Ds; interface Collection extends Countable cannot express.
Guards the trap that makes the tests above necessary: parse() is a convenience wrapper that calls parseNode() with no imports, so it resolves an imported parent against the declaring namespace instead. Production always goes through extractAndParseAll().
Details
protected void
setUp()
No description
testItDeclaresAndReturnsPHPInterface()
Pins both halves of parse()'s type contract. assertInstanceOf alone is weak here: it keeps
passing if the : PHPInterface declaration is dropped or widened, as long as the body still
happens to return the right thing. Asserting the declared return type catches the loosening
itself, which is the change that would silently let a different entity type escape.
testItCanParseSimpleInterfaceName()
No description
testItSetsRootNamespaceForInterfaceWithoutNamespace()
No description
testItCanParseNamespace()
No description
testItCanParseInterfaceName()
No description
testItCanParseId()
No description
testItCanParseIdWithRootNamespace()
No description
testItSetsEmptyArrayIfNoMethodsInInterface()
No description
testItCanParseInterfaceWithMethods()
No description
testItReturnsCorrectInstanceForMethod()
No description
testItReturnsActuallyParsedMethods()
No description
testItSetsEmptyArrayIfNoConstantsInInterface()
No description
testItCanParseInterfaceConstants()
No description
testItReturnsCorrectInstanceForConstant()
No description
testItReturnsActuallyParsedConstants()
No description
testItSetsEmptyArraysForParentInterfacesIfNoAny()
No description
testItCanParseParentInterfaces()
No description
testItReturnsCorrectInstanceForParentInterface()
No description
testItReturnsParentInterfacesWithCorrectName()
No description
testItReturnsAllActuallyParsedParentInterfaces()
No description
testItParsesConstantsCorrectly()
No description
testUnqualifiedParentResolvesWithinTheDeclaringNamespace()
An unqualified parent resolves within the declaring namespace, per PHP's rule for
class-like names. Storing only the short name let ClassHierarchyResolver match
MongoDB\BSON\Persistable extends Serializable against the global \Serializable.
testParentInRootNamespaceKeepsASingleLeadingSeparator()
No description
testQualifiedParentKeepsShortNameAndQualifiedId()
The stored name stays short even when the source writes a qualified parent, so the resolver's short-name fallback still works for stubs whose qualified id does not exist.
testMultipleParentsAreEachResolved()
No description
testImportedParentResolvesToTheImportedNamespace()
A use statement must win over the declaring namespace, otherwise an imported parent
is silently rewritten to a same-namespace name that does not exist.
testAliasedImportResolvesToTheTargetAndKeepsTheTargetShortName()
No description
testImportOfAGlobalInterfaceResolvesToTheRootNamespace()
Importing a global interface is how a stub says "the root-namespace one" — the case
namespace Ds; interface Collection extends Countable cannot express.
testParseWithoutImportsResolvesAgainstTheNamespaceInstead()
Guards the trap that makes the tests above necessary: parse() is a convenience wrapper that calls parseNode() with no imports, so it resolves an imported parent against the declaring namespace instead. Production always goes through extractAndParseAll().
Asserted so the discrepancy is visible rather than quietly misleading a test author.