comparison vendor/squizlabs/php_codesniffer/tests/AllTests.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 <?php
2 /**
3 * A test class for running all PHP_CodeSniffer unit tests.
4 *
5 * @author Greg Sherwood <gsherwood@squiz.net>
6 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
7 * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
8 */
9
10 namespace PHP_CodeSniffer\Tests;
11
12 use PHPUnit\TextUI\TestRunner;
13
14 if (is_file(__DIR__.'/../autoload.php') === true) {
15 include_once 'Core/AllTests.php';
16 include_once 'Standards/AllSniffs.php';
17 } else {
18 include_once 'CodeSniffer/Core/AllTests.php';
19 include_once 'CodeSniffer/Standards/AllSniffs.php';
20 }
21
22 // PHPUnit 7 made the TestSuite run() method incompatible with
23 // older PHPUnit versions due to return type hints, so maintain
24 // two different suite objects.
25 $phpunit7 = false;
26 if (class_exists('\PHPUnit\Runner\Version') === true) {
27 $version = \PHPUnit\Runner\Version::id();
28 if ($version[0] === '7') {
29 $phpunit7 = true;
30 }
31 }
32
33 if ($phpunit7 === true) {
34 include_once 'TestSuite7.php';
35 } else {
36 include_once 'TestSuite.php';
37 }
38
39 class PHP_CodeSniffer_AllTests
40 {
41
42
43 /**
44 * Add all PHP_CodeSniffer test suites into a single test suite.
45 *
46 * @return \PHPUnit\Framework\TestSuite
47 */
48 public static function suite()
49 {
50 $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'] = [];
51 $GLOBALS['PHP_CODESNIFFER_TEST_DIRS'] = [];
52
53 // Use a special PHP_CodeSniffer test suite so that we can
54 // unset our autoload function after the run.
55 $suite = new TestSuite('PHP CodeSniffer');
56
57 $suite->addTest(Core\AllTests::suite());
58 $suite->addTest(Standards\AllSniffs::suite());
59
60 return $suite;
61
62 }//end suite()
63
64
65 }//end class