Changeset 49037 for trunk/tests/phpunit/includes/phpunit7/testcase.php
- Timestamp:
- 09/23/2020 01:52:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.