Skip to content

Commit

Permalink
Fixing mlively#4
Browse files Browse the repository at this point in the history
Hard coded the Phake_IMock addition, as picking it up from the
of the openapi.

Added an extra check for namespaced classnames being passed to Phake.mock.
  • Loading branch information
Tim Heilig committed Sep 11, 2015
1 parent 6ee61ee commit ab85fa1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/com/digitalsandwich/phake/PhakeMockTypeProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,20 @@ public Collection<? extends PhpNamedElement> getBySignature(String s, Project pr
Collection<PhpNamedElement> signedClasses = new ArrayList<PhpNamedElement>();
if (s.substring(0, 4).equals(CALLTYPE_MOCK))
{
signedClasses.add(phpIndex.getClassByName("Phake_IMock"));
int separator = s.indexOf("~");
String phakeSignature = s.substring(4, separator);
String className = s.substring(separator + 1);

PhpClass phpClass = phpIndex.getClassByName(className);
signedClasses.addAll(phpIndex.getBySignature(phakeSignature));
Collection<PhpClass> fqnClasses = phpIndex.getClassesByFQN(className);
if (phpClass != null)
{
signedClasses.add(phpClass);
}
else if (fqnClasses.size() > 0)
{
signedClasses.addAll(fqnClasses);
}
else
{
signedClasses.addAll(phpIndex.getInterfacesByName(className));
Expand Down

0 comments on commit ab85fa1

Please sign in to comment.