From: Yuri Astrakhan Date: Mon, 16 Mar 2015 23:37:38 +0000 (+0300) Subject: Fixed phpunit exception test X-Git-Tag: 1.31.0-rc.0~12073 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=95f22fafaf2f7c62e48e5f79b0b52a34b3a8c260;p=lhc%2Fweb%2Fwiklou.git Fixed phpunit exception test phpunit has removed that class in https://github.com/sebastianbergmann/phpunit/commit/f0322b6978bc2b6fd9a17f499950a4b023ef3db4 instead adding a dependency on "sebastian/comparator": "dev-master" https://github.com/sebastianbergmann/comparator The class name changed from PHPUnit_Framework_ComparisonFailure to \SebastianBergmann\Comparator\ComparisonFailure\ComparisonFailure Bug: T90880 Change-Id: I8988d0b07c00f54c8c8dd38a5e92a5736d88b163 --- diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index 1220bb4891..e664173dc6 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -116,9 +116,16 @@ STR; if ( is_array( $message ) ) { $message = http_build_query( $message ); } + + // FIXME: once we migrate to phpunit 4.1+, hardcode ComparisonFailure exception use + $compEx = 'SebastianBergmann\Comparator\ComparisonFailure'; + if ( !class_exists( $compEx ) ) { + $compEx = 'PHPUnit_Framework_ComparisonFailure'; + } + throw new PHPUnit_Framework_ExpectationFailedException( $e->getMessage() . "\nRequest: $message", - new PHPUnit_Framework_ComparisonFailure( + new $compEx( $exp, $result, print_r( $exp, true ),