Advertisement
Guest User

Untitled

a guest
May 25th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public function testAllPublicFunctionsTested()
  2. {
  3. $called= "App".substr( get_called_class(), 4, -4 );
  4.  
  5. $class = new \ReflectionClass( $called );
  6.  
  7. $traits = $class->getTraits();
  8.  
  9. foreach( $class->getMethods( ReflectionMethod::IS_PUBLIC ) as $methodObj )
  10. {
  11. foreach( $traits as $trait)
  12. {
  13. if( $trait->hasMethod( $methodObj->getName() ) )
  14. {
  15. continue 2;
  16. }
  17. }
  18.  
  19. if( $methodObj->class == $called )
  20. {
  21. $this->assertFalse(
  22. strpos( $methodObj->getName(), 'scope') === false &&
  23. !method_exists( $this, 'test'.ucfirst( $methodObj->getName() ) ),
  24. "\nNo Test for public method ".$methodObj->class."::".$methodObj->getName()." in class ".get_called_class()."\n"
  25. );
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement