Skip to content

Instantly share code, notes, and snippets.

@martinschaepker
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinschaepker/8301ae23bcd963563735 to your computer and use it in GitHub Desktop.
Save martinschaepker/8301ae23bcd963563735 to your computer and use it in GitHub Desktop.
get All not tested public methods
public function testAllPublicFunctionsTested()
{
$called= "App".substr( get_called_class(), 4, -4 );
$class = new \ReflectionClass( $called );
$traits = $class->getTraits();
foreach( $class->getMethods( ReflectionMethod::IS_PUBLIC ) as $methodObj )
{
foreach( $traits as $trait)
{
if( $trait->hasMethod( $methodObj->getName() ) )
{
continue 2;
}
}
if( $methodObj->class == $called )
{
$this->assertFalse(
strpos( $methodObj->getName(), 'scope') === false &&
!method_exists( $this, 'test'.ucfirst( $methodObj->getName() ) ),
"\nNo Test for public method ".$methodObj->class."::".$methodObj->getName()." in class ".get_called_class()."\n"
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment