Skip to content

Commit 8548aed

Browse files
committed
Make test provider functions static
1 parent adb1f9e commit 8548aed

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

cleaner/backup/tests/cleaner_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
class cleaner_backup_test extends \advanced_testcase {
2929

30-
public function delete_provider() {
30+
public static function delete_provider() {
3131
// Array of filename, deleted.
3232
return [
3333
['myfile.txt', false],

cleaner/email/tests/cleaner_email_test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function test_cleaner_email_suffix_ignore_pattern($input, $expected, $suf
154154
*
155155
* @return array
156156
*/
157-
public function provider_for_cleaner_email_suffix_ignore_pattern() {
157+
public static function provider_for_cleaner_email_suffix_ignore_pattern() {
158158
return [
159159
['[email protected]', '[email protected]', '.suffix', 'moodle.com'],
160160
['[email protected]', '[email protected]', '.suffix', 'emailsuffix.com'],

cleaner/muc/tests/phpunit/events_test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function setUp() : void {
3737
$this->resetAfterTest(false);
3838
}
3939

40-
public function provider_for_test_events_have_the_correct_properties() {
40+
public static function provider_for_test_events_have_the_correct_properties() {
4141
return [
4242
[muc_config_saved::class, 'c'],
4343
[muc_config_deleted::class, 'd'],
@@ -70,7 +70,7 @@ public function test_events_have_the_correct_properties($class, $crud) {
7070
self::assertSame($expected, $actual);
7171
}
7272

73-
public function provider_for_test_events_have_the_correct_description() {
73+
public static function provider_for_test_events_have_the_correct_description() {
7474
return [
7575
[
7676
muc_config_saved::class,

tests/unit/table_scrambler_test.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
* @SuppressWarnings(public) Allow as many methods as needed.
3838
*/
3939
class local_datacleaner_table_scrambler_test extends advanced_testcase {
40-
public function provider_for_it_creates_sorted_temporary_tables() {
40+
public static function provider_for_it_creates_sorted_temporary_tables() {
4141
return [
4242
'unrepeated' => [
43-
$this->create_test_data_array(),
43+
self::create_test_data_array(),
4444
[
4545
['id' => '1', 'value' => 'Bill'],
4646
['id' => '2', 'value' => 'David'],
@@ -75,7 +75,7 @@ public function provider_for_it_creates_sorted_temporary_tables() {
7575
];
7676
}
7777

78-
public function provider_for_it_scrambles_names() {
78+
public static function provider_for_it_scrambles_names() {
7979
return [
8080
['', [
8181
['id' => '1', 'first' => 'David', 'last' => 'Jones'],
@@ -96,7 +96,7 @@ public function provider_for_it_scrambles_names() {
9696
];
9797
}
9898

99-
public function provider_for_the_next_prime_after() {
99+
public static function provider_for_the_next_prime_after() {
100100
return [
101101
[0, 2],
102102
[1, 2],
@@ -105,7 +105,7 @@ public function provider_for_the_next_prime_after() {
105105
];
106106
}
107107

108-
public function provider_for_the_prime_factors() {
108+
public static function provider_for_the_prime_factors() {
109109
return [
110110
[2, 1, [2, 3]],
111111
[2, 3, [2, 3]],
@@ -216,7 +216,7 @@ private function create_test_data($data = null) {
216216
global $DB;
217217

218218
if (is_null($data)) {
219-
$data = $this->create_test_data_array();
219+
$data = self::create_test_data_array();
220220
}
221221

222222
// Create test table.
@@ -237,7 +237,7 @@ private function create_test_data($data = null) {
237237
return $table;
238238
}
239239

240-
private function create_test_data_array() {
240+
private static function create_test_data_array() {
241241
return [
242242
['first' => 'David', 'last' => 'Smith'],
243243
['first' => 'Nicholas', 'last' => 'Hoobin'],

0 commit comments

Comments
 (0)