Last active
August 29, 2015 14:19
-
-
Save martinschaepker/8301ae23bcd963563735 to your computer and use it in GitHub Desktop.
get All not tested public methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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