Unverified Commit b7020a52 authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

tests(phpunit): Make PHPUnit work again on newer PHP versions (#3097302)

parent 74757b97
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -19,8 +19,9 @@ use PHP_CodeSniffer\Files\LocalFile;
use PHP_CodeSniffer\Exceptions\RuntimeException;
use PHP_CodeSniffer\Util\Common;
use PHP_CodeSniffer\Util\Tokens;
use PHPUnit\Framework\TestCase;

abstract class CoderSniffUnitTest extends \PHPUnit_Framework_TestCase
abstract class CoderSniffUnitTest extends TestCase
{

    /**
@@ -124,7 +125,7 @@ abstract class CoderSniffUnitTest extends \PHPUnit_Framework_TestCase
     * @preserveGlobalState disabled
     *
     * @return void
     * @throws PHPUnit_Framework_Error
     * @throws \PHPUnit\Framework\Exception
     */
    final public function testSniff()
    {
+5 −0
Original line number Diff line number Diff line
@@ -3,3 +3,8 @@
require 'vendor/autoload.php';
require 'CoderSniffUnitTest.php';
require 'vendor/squizlabs/php_codesniffer/autoload.php';

// Support older versions of PHPUnit on older PHP versions.
if (class_exists('PHPUnit_Framework_TestCase') === true && class_exists('PHPUnit\Framework\TestCase') === false) {
    class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\Framework\TestCase');
}
+2 −1
Original line number Diff line number Diff line
@@ -3,11 +3,12 @@
namespace DrupalPractice\ProjectDetection;

use DrupalPractice\Project;
use PHPUnit\Framework\TestCase;

/**
 * Tests that project and version detection works.
 */
class ProjectUnitTest extends \PHPUnit_Framework_TestCase
class ProjectUnitTest extends TestCase
{

    /**
+1 −1
Original line number Diff line number Diff line
@@ -26,6 +26,6 @@
        }
    },
    "require-dev": {
        "phpunit/phpunit": ">=3.7 <6"
        "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
    }
}
+1 −7
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="coder_sniffer/Drupal/Test/phpunit-bootstrap.php" colors="true">
<phpunit bootstrap="coder_sniffer/Drupal/Test/phpunit-bootstrap.php" beStrictAboutTestsThatDoNotTestAnything="false" colors="true">
  <testsuites>
    <testsuite name="Coder Sniffer Drupal Test Suite">
      <directory>coder_sniffer/Drupal/Test</directory>
@@ -9,10 +9,4 @@
      <directory>coder_sniffer/DrupalPractice/Test</directory>
    </testsuite>
  </testsuites>
  <!-- Filter for coverage reports. -->
  <filter>
    <blacklist>
      <directory>./vendor</directory>
    </blacklist>
  </filter>
</phpunit>