<?php

namespace PHPUnit\Framework {

    /*
     * TestCase::class cannot be used because it would break code generation in Magento 2.1
     * where the code scanner looks for the first "class" keyword.
     */
    if (!class_exists('\PHPUnit\Framework\TestCase')) {
        /*
         * Forward compatibility for PHPUnit 4.x (Magento 2.1)
         */
        abstract class TestCase extends \PHPUnit_Framework_TestCase
        {
            public function expectException($exceptionName)
            {
                $this->setExpectedException($exceptionName);
            }
        }
    }
}

<?php

namespace PHPUnit\Framework {

    if (!class_exists(TestCase::class)) {
        /*
         * Forward compatibility for PHPUnit 4.x (Magento 2.1)
         */
        abstract class TestCase extends \PHPUnit_Framework_TestCase
        {
            public function expectException($exceptionName)
            {
                $this->setExpectedException($exceptionName);
            }
        }
    }
}

--- 
+++ 
@@ -2,7 +2,11 @@
 
 namespace PHPUnit\Framework {
 
-    if (!class_exists(TestCase::class)) {
+    /*
+     * TestCase::class cannot be used because it would break code generation in Magento 2.1
+     * where the code scanner looks for the first "class" keyword.
+     */
+    if (!class_exists('\PHPUnit\Framework\TestCase')) {
         /*
          * Forward compatibility for PHPUnit 4.x (Magento 2.1)
          */
Fix compilation error in Magento 2.1
