Index: tests/phpunit/includes/bootstrap.php
===================================================================
--- tests/phpunit/includes/bootstrap.php	(revision 40258)
+++ tests/phpunit/includes/bootstrap.php	(working copy)
@@ -3,6 +3,12 @@
  * Installs WordPress for running the tests and loads WordPress and the test libraries
  */
 
+/**
+ * Migration fixer for PHPUnit 6
+ */
+if ( class_exists( 'PHPUnit\Runner\Version' ) ) {
+	require_once dirname( __FILE__ ) . '/phpunit6-compat.php';
+}
 
 $config_file_path = dirname( dirname( __FILE__ ) );
 if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
Index: tests/phpunit/includes/phpunit6-compat.php
===================================================================
--- tests/phpunit/includes/phpunit6-compat.php	(nonexistent)
+++ tests/phpunit/includes/phpunit6-compat.php	(working copy)
@@ -0,0 +1,35 @@
+<?php
+
+if ( class_exists( 'PHPUnit\Runner\Version' ) && version_compare( PHPUnit\Runner\Version::id(), '6.0', '>=' ) ) {
+	class_alias( 'PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase' );
+	class_alias( 'PHPUnit\Framework\Exception', 'PHPUnit_Framework_Exception' );
+	class_alias( 'PHPUnit\Framework\ExpectationFailedException', 'PHPUnit_Framework_ExpectationFailedException' );
+	class_alias( 'PHPUnit\Framework\Error\Notice', 'PHPUnit_Framework_Error_Notice' );
+	class_alias( 'PHPUnit\Framework\Test', 'PHPUnit_Framework_Test' );
+	class_alias( 'PHPUnit\Framework\Warning', 'PHPUnit_Framework_Warning' );
+	class_alias( 'PHPUnit\Framework\AssertionFailedError', 'PHPUnit_Framework_AssertionFailedError' );
+	class_alias( 'PHPUnit\Framework\TestSuite', 'PHPUnit_Framework_TestSuite' );
+	class_alias( 'PHPUnit\Framework\TestListener', 'PHPUnit_Framework_TestListener' );
+	class_alias( 'PHPUnit\Util\GlobalState', 'PHPUnit_Util_GlobalState' );
+	class_alias( 'PHPUnit\Util\Getopt', 'PHPUnit_Util_Getopt' );
+
+	class PHPUnit_Util_Test extends PHPUnit\Util\Test {
+		public static function getTickets( $className, $methodName ) {
+			$annotations = self::parseTestMethodAnnotations(
+			$className, $methodName
+			);
+
+			$tickets = array();
+
+			if (isset($annotations['class']['ticket'])) {
+				$tickets = $annotations['class']['ticket'];
+			}
+
+			if (isset($annotations['method']['ticket'])) {
+				$tickets = array_merge($tickets, $annotations['method']['ticket']);
+			}
+
+			return array_unique($tickets);
+		}
+	}
+}
Index: tests/phpunit/includes/testcase-ajax.php
===================================================================
--- tests/phpunit/includes/testcase-ajax.php	(revision 40258)
+++ tests/phpunit/includes/testcase-ajax.php	(working copy)
@@ -200,4 +200,25 @@
 		if ( !empty( $buffer ) )
 			$this->_last_response = $buffer;
 	}
+
+	/**
+	 * PHPUnit 6 compatibility shim.
+	 *
+	 * @param mixed      $exception
+	 * @param string     $message
+	 * @param int|string $code
+	 */
+	protected function _setExpectedException( $exception, $message = '', $code = null ) {
+		if ( method_exists( $this, 'setExpectedException' ) ) {
+			$this->setExpectedException( $exception, $message, $code );
+		} else {
+			$this->expectException( $exception );
+			if ( '' !== $message ) {
+				$this->expectExceptionMessage( $message );
+			}
+			if ( null !== $code ) {
+				$this->expectExceptionCode( $code );
+			}
+		}
+	}
 }
Index: tests/phpunit/tests/ajax/Compression.php
===================================================================
--- tests/phpunit/tests/ajax/Compression.php	(revision 40258)
+++ tests/phpunit/tests/ajax/Compression.php	(working copy)
@@ -25,7 +25,7 @@
 		$_GET['test'] = 1;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '0' );
 		$this->_handleAjax( 'wp-compression-test' );
 	}
 
@@ -118,7 +118,7 @@
 		$_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'wp-compression-test' );
 	}
 
Index: tests/phpunit/tests/ajax/CustomizeMenus.php
===================================================================
--- tests/phpunit/tests/ajax/CustomizeMenus.php	(revision 40258)
+++ tests/phpunit/tests/ajax/CustomizeMenus.php	(working copy)
@@ -54,7 +54,7 @@
 
 		if ( 'administrator' != $role ) {
 			// If we're not an admin, we should get a wp_die(-1).
-			$this->setExpectedException( 'WPAjaxDieStopException' );
+			$this->_setExpectedException( 'WPAjaxDieStopException' );
 		}
 
 		wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
@@ -429,7 +429,7 @@
 
 		if ( 'administrator' != $role ) {
 			// If we're not an admin, we should get a wp_die(-1).
-			$this->setExpectedException( 'WPAjaxDieStopException' );
+			$this->_setExpectedException( 'WPAjaxDieStopException' );
 		}
 
 		wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
Index: tests/phpunit/tests/ajax/DeleteComment.php
===================================================================
--- tests/phpunit/tests/ajax/DeleteComment.php	(revision 40258)
+++ tests/phpunit/tests/ajax/DeleteComment.php	(working copy)
@@ -133,7 +133,7 @@
 		$_POST['_url']        = admin_url( 'edit-comments.php' );
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'delete-comment' );
 	}
 
@@ -163,7 +163,7 @@
 		$_POST['_url']        = admin_url( 'edit-comments.php' );
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'delete-comment' );
 	}
 
Index: tests/phpunit/tests/ajax/DimComment.php
===================================================================
--- tests/phpunit/tests/ajax/DimComment.php	(revision 40258)
+++ tests/phpunit/tests/ajax/DimComment.php	(working copy)
@@ -127,7 +127,7 @@
 		$_POST['_url']        = admin_url( 'edit-comments.php' );
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'dim-comment' );
 	}
 
@@ -154,7 +154,7 @@
 		$_POST['_url']        = admin_url( 'edit-comments.php' );
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'dim-comment' );
 	}
 
Index: tests/phpunit/tests/ajax/EditComment.php
===================================================================
--- tests/phpunit/tests/ajax/EditComment.php	(revision 40258)
+++ tests/phpunit/tests/ajax/EditComment.php	(working copy)
@@ -142,7 +142,7 @@
 		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'edit-comment' );
 	}
 
@@ -168,7 +168,7 @@
 		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'get-comments' );
 	}
 
@@ -188,7 +188,7 @@
 		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'edit-comment' );
 	}
 }
Index: tests/phpunit/tests/ajax/GetComments.php
===================================================================
--- tests/phpunit/tests/ajax/GetComments.php	(revision 40258)
+++ tests/phpunit/tests/ajax/GetComments.php	(working copy)
@@ -88,7 +88,7 @@
 		$_POST['p']           = self::$comment_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'get-comments' );
 	}
 
@@ -108,7 +108,7 @@
 		$_POST['p']           = self::$comment_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'get-comments' );
 	}
 
@@ -128,7 +128,7 @@
 		$_POST['p']           = 'b0rk';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'get-comments' );
 	}
 
@@ -148,7 +148,7 @@
 		$_POST['p']           = self::$no_comment_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '1' );
 		$this->_handleAjax( 'get-comments' );
 	}
 }
Index: tests/phpunit/tests/ajax/ReplytoComment.php
===================================================================
--- tests/phpunit/tests/ajax/ReplytoComment.php	(revision 40258)
+++ tests/phpunit/tests/ajax/ReplytoComment.php	(working copy)
@@ -107,7 +107,7 @@
 		$_POST['comment_post_ID']             = self::$comment_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'replyto-comment' );
 	}
 
@@ -134,7 +134,7 @@
 		$_POST['comment_post_ID']             = self::$comment_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'replyto-comment' );
 	}
 
@@ -154,7 +154,7 @@
 		$_POST['comment_post_ID']             = 123456789;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'replyto-comment' );
 	}
 
@@ -174,7 +174,7 @@
 		$_POST['comment_post_ID']             = self::$draft_post->ID;
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
 		$this->_handleAjax( 'replyto-comment' );
 	}
 
Index: tests/phpunit/tests/ajax/TagSearch.php
===================================================================
--- tests/phpunit/tests/ajax/TagSearch.php	(revision 40258)
+++ tests/phpunit/tests/ajax/TagSearch.php	(working copy)
@@ -68,7 +68,7 @@
 
 		// Make the request
 		// No output, so we get a stop exception
-		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '0' );
 		$this->_handleAjax( 'ajax-tag-search' );
 	}
 
@@ -108,7 +108,7 @@
 		$_GET['q']   = 'chat';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'ajax-tag-search' );
 	}
 
@@ -125,7 +125,7 @@
 		$_GET['q']   = 'chat';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '0' );
 		$this->_handleAjax( 'ajax-tag-search' );
 	}
 
@@ -142,7 +142,7 @@
 		$_GET['q']   = 'chat';
 
 		// Make the request
-		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_setExpectedException( 'WPAjaxDieStopException', '-1' );
 		$this->_handleAjax( 'ajax-tag-search' );
 	}
 
