Changeset 49037
- Timestamp:
- 09/23/2020 01:52:02 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 21 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/composer.json
r47927 r49037 17 17 "wp-coding-standards/wpcs": "~2.3.0", 18 18 "phpcompatibility/phpcompatibility-wp": "^2.1.0", 19 "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5" 19 "phpunit/phpunit": "^7.5" 20 }, 21 "autoload-dev": { 22 "files": [ 23 "tests/phpunit/includes/phpunit7/MockObject/Builder/NamespaceMatch.php", 24 "tests/phpunit/includes/phpunit7/MockObject/Builder/ParametersMatch.php", 25 "tests/phpunit/includes/phpunit7/MockObject/InvocationMocker.php", 26 "tests/phpunit/includes/phpunit7/MockObject/MockMethod.php" 27 ], 28 "exclude-from-classmap": [ 29 "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php", 30 "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php", 31 "vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php", 32 "vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php" 33 ] 20 34 }, 21 35 "scripts": { -
trunk/phpcs.xml.dist
r48072 r49037 135 135 <exclude-pattern>/src/wp-includes/Text/*</exclude-pattern> 136 136 137 <exclude-pattern>/tests/phpunit/includes/phpunit7/MockObject/*</exclude-pattern> 137 138 <exclude-pattern>/tests/phpunit/includes/speed-trap-listener\.php</exclude-pattern> 138 139 -
trunk/tests/phpunit/includes/phpunit7/testcase.php
r48972 r49037 38 38 static::assertThat( $actual, $constraint, $message ); 39 39 } 40 41 /**42 * Returns a mock object for the specified abstract class with all abstract43 * methods of the class mocked. Concrete methods to mock can be specified with44 * the last parameter.45 *46 * This method replaces the native PHPUnit method to avoid parse errors47 * due to `match` being a reserved keyword in PHP 8.48 *49 * To run on PHP 8, the tests using this method require PHPUnit 9.3 or later.50 *51 * When the test suite is updated for compatibility with PHPUnit 9.x,52 * this override can be removed.53 *54 * @since 5.6.055 *56 * @param string $original_class_name57 * @param string $mock_class_name58 * @param bool $call_original_constructor59 * @param bool $call_original_clone60 * @param bool $call_autoload61 * @param array $mocked_methods62 * @param bool $clone_arguments63 *64 * @throws \ReflectionException65 * @throws RuntimeException66 * @throws Exception67 *68 * @return MockObject69 */70 public function getMockForAbstractClass( $original_class_name, array $arguments = array(), $mock_class_name = '', $call_original_constructor = true, $call_original_clone = true, $call_autoload = true, $mocked_methods = array(), $clone_arguments = false ): PHPUnit\Framework\MockObject\MockObject {71 if ( PHP_VERSION_ID >= 80000 && version_compare( tests_get_phpunit_version(), '9.3', '<' ) ) {72 $this->markTestSkipped( 'To run on PHP 8, this test requires PHPUnit 9.3 or later.' );73 }74 75 return parent::getMockForAbstractClass( $original_class_name, $arguments, $mock_class_name, $call_original_constructor, $call_original_clone, $call_autoload, $mocked_methods, $clone_arguments );76 }77 78 /**79 * Returns a builder object to create mock objects using a fluent interface.80 *81 * This method replaces the native PHPUnit method to avoid parse errors82 * due to `match` being a reserved keyword in PHP 8.83 *84 * To run on PHP 8, the tests using this method require PHPUnit 9.3 or later.85 *86 * When the test suite is updated for compatibility with PHPUnit 9.x,87 * this override can be removed.88 *89 * @since 5.6.090 *91 * @param string|string[] $class_name92 */93 public function getMockBuilder( $class_name ): PHPUnit\Framework\MockObject\MockBuilder {94 if ( PHP_VERSION_ID >= 80000 && version_compare( tests_get_phpunit_version(), '9.3', '<' ) ) {95 $this->markTestSkipped( 'To run on PHP 8, this test requires PHPUnit 9.3 or later.' );96 }97 98 return parent::getMockBuilder( $class_name );99 }100 40 }
Note: See TracChangeset
for help on using the changeset viewer.