Skip to content

Commit

Permalink
Tests: make dataproviders static
Browse files Browse the repository at this point in the history
As of PHPUnit 10, data providers are (again) expected to be `static` methods.

This updates the test suite to respect that.
  • Loading branch information
jrfnl committed Nov 20, 2023
1 parent 0021f0d commit 0ab20c1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/Unit/Admin/Options_Form_Generator_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public function test_is_checked( $option, $option_values, $parent_option, $asser
*
* @return array The data to run the test against.
*/
public function is_checked_provider() {
public static function is_checked_provider() {
return [
[
'test_option',
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Permissions_Helper_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function test_is_edit_post_screen( $original, $expected ) {
*
* @return array The test parameters.
*/
public function is_edit_post_screen_provider() {
public static function is_edit_post_screen_provider() {
return [
[
'original' => [
Expand Down Expand Up @@ -339,7 +339,7 @@ public function test_is_new_post_screen( $original, $expected ) {
*
* @return array The test parameters.
*/
public function is_new_post_screen_provider() {
public static function is_new_post_screen_provider() {
return [
[
'original' => [
Expand Down Expand Up @@ -416,7 +416,7 @@ public function test_is_classic_editor( $original, $expected ) {
*
* @return array The test parameters.
*/
public function is_classic_editor_provider() {
public static function is_classic_editor_provider() {
return [
[
'original' => [
Expand Down Expand Up @@ -677,7 +677,7 @@ public function test_should_rewrite_and_republish_be_allowed( $original, $expect
*
* @return array The test parameters.
*/
public function should_rewrite_and_republish_be_allowed_provider() {
public static function should_rewrite_and_republish_be_allowed_provider() {
return [
[
'original' => [
Expand Down Expand Up @@ -749,7 +749,7 @@ public function test_post_type_has_admin_bar( $original, $expected ) {
*
* @return array The test parameters.
*/
public function post_type_has_admin_bar_provider() {
public static function post_type_has_admin_bar_provider() {
return [
[
'original' => [
Expand Down Expand Up @@ -819,7 +819,7 @@ public function test_is_copy_allowed_to_be_republished( $post_status, $expected
*
* @return array The test parameters.
*/
public function is_copy_allowed_to_be_republished_provider() {
public static function is_copy_allowed_to_be_republished_provider() {
return [
[
'post_status' => 'dp-rewrite-republish',
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Post_Duplicator_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function test_generate_copy_title( $original, $expected ) {
*
* @return array
*/
public function generate_copy_title_provider() {
public static function generate_copy_title_provider() {
$data = [];

$data[] = [
Expand Down Expand Up @@ -186,7 +186,7 @@ static function ( $post_type ) {
*
* @return array
*/
public function generate_copy_status_provider() {
public static function generate_copy_status_provider() {
$data = [];

$data[] = [
Expand Down Expand Up @@ -290,7 +290,7 @@ static function ( $post_type ) {
*
* @return array
*/
public function generate_copy_author_provider() {
public static function generate_copy_author_provider() {
$data = [];

$data[] = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Post_Republisher_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function test_change_post_copy_status( $input, $expected ) {
*
* @return array
*/
public function change_post_copy_status_provider() {
public static function change_post_copy_status_provider() {
return [
[
[
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/UI/Block_Editor_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function test_should_previously_used_keyword_assessment_run( $original, $
*
* @return array The test parameters.
*/
public function should_previously_used_keyword_assessment_run_provider() {
public static function should_previously_used_keyword_assessment_run_provider() {
return [
[
'original' => [
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Utils_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function test_flatten_version( $original, $expected ) {
*
* @return array
*/
public function flatten_version_provider() {
public static function flatten_version_provider() {
return [
[ '3.0', '300' ],
[ '1.4', '140' ],
Expand Down Expand Up @@ -56,7 +56,7 @@ public function test_addslashes_to_strings_only( $original, $expected ) {
*
* @return array
*/
public function addslashes_to_strings_only_provider() {
public static function addslashes_to_strings_only_provider() {
return [
[ "O'Reilly", "O\'Reilly" ],
[ 'A string with "quotes"', 'A string with \"quotes\"' ],
Expand Down

0 comments on commit 0ab20c1

Please sign in to comment.