compat.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. if ( class_exists( 'PHPUnit\Runner\Version' ) && version_compare( PHPUnit\Runner\Version::id(), '6.0', '>=' ) ) {
  3. class_alias( 'PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase' );
  4. class_alias( 'PHPUnit\Framework\Exception', 'PHPUnit_Framework_Exception' );
  5. class_alias( 'PHPUnit\Framework\ExpectationFailedException', 'PHPUnit_Framework_ExpectationFailedException' );
  6. class_alias( 'PHPUnit\Framework\Error\Deprecated', 'PHPUnit_Framework_Error_Deprecated' );
  7. class_alias( 'PHPUnit\Framework\Error\Notice', 'PHPUnit_Framework_Error_Notice' );
  8. class_alias( 'PHPUnit\Framework\Error\Warning', 'PHPUnit_Framework_Error_Warning' );
  9. class_alias( 'PHPUnit\Framework\Test', 'PHPUnit_Framework_Test' );
  10. class_alias( 'PHPUnit\Framework\Warning', 'PHPUnit_Framework_Warning' );
  11. class_alias( 'PHPUnit\Framework\AssertionFailedError', 'PHPUnit_Framework_AssertionFailedError' );
  12. class_alias( 'PHPUnit\Framework\Constraint\IsEqual', 'PHPUnit_Framework_Constraint_IsEqual' );
  13. class_alias( 'PHPUnit\Framework\TestSuite', 'PHPUnit_Framework_TestSuite' );
  14. class_alias( 'PHPUnit\Framework\TestListener', 'PHPUnit_Framework_TestListener' );
  15. class_alias( 'PHPUnit\Util\GlobalState', 'PHPUnit_Util_GlobalState' );
  16. class_alias( 'PHPUnit\Util\Getopt', 'PHPUnit_Util_Getopt' );
  17. class PHPUnit_Util_Test {
  18. // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
  19. public static function getTickets( $class_name, $method_name ) {
  20. $annotations = PHPUnit\Util\Test::parseTestMethodAnnotations( $class_name, $method_name );
  21. $tickets = array();
  22. if ( isset( $annotations['class']['ticket'] ) ) {
  23. $tickets = $annotations['class']['ticket'];
  24. }
  25. if ( isset( $annotations['method']['ticket'] ) ) {
  26. $tickets = array_merge( $tickets, $annotations['method']['ticket'] );
  27. }
  28. return array_unique( $tickets );
  29. }
  30. }
  31. }