From 95f22fafaf2f7c62e48e5f79b0b52a34b3a8c260 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 17 Mar 2015 02:37:38 +0300 Subject: [PATCH] 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 --- tests/phpunit/includes/api/query/ApiQueryTestBase.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ), -- 2.20.1