Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: minor modernization #147

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^4.5 || ^5.7 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"roave/security-advisories": "dev-master",
"yoast/yoastcs": "^2.3.0"
},
Expand Down
4 changes: 3 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
* @package Yoast\WHIP
*/

use PHPUnit\Framework\TestCase;

/**
* Base test case class from which all tests should extend.
*/
abstract class Whip_TestCase extends PHPUnit_Framework_TestCase {
abstract class Whip_TestCase extends TestCase {

/**
* Helper method to test exceptions.
Expand Down
16 changes: 0 additions & 16 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,6 @@
* @package Yoast\WHIP
*/

/*
* PHPUnit cross version compatibility.
*
* The classes in PHPUnit have been renamed to namespaced classes.
* The namespaced alias for the TestCase class is available as of PHPUnit 5.4 and as of
* PHPUnit 6.0, the non-namespaced versions are no longer available.
* As PHPUnit 6.0 requires PHP 7 anyway, the PHP 5.3 function class_alias() will be available,
* so we can use it to alias the class back to the old class name.
*/
if ( class_exists( 'PHPUnit\Framework\TestCase' ) === true
&& class_exists( 'PHPUnit_Framework_TestCase' ) === false
) {
// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.class_aliasFound
class_alias( 'PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase' );
}

if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
require_once __DIR__ . '/../vendor/autoload.php';
}
Expand Down