Skip to content

Commit 30a0ac5

Browse files
dustinhuynhbrendanheywood
authored andcommitted
Fix CI complains #700
1 parent edc937c commit 30a0ac5

21 files changed

+403
-434
lines changed

classes/local/store/s3/admin_settings_aws_region.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ public function output_html($data, $query='') {
6363
}
6464
}
6565

66-
$inputparams = array(
66+
$inputparams = [
6767
'type' => 'text',
6868
'list' => $this->get_full_name(),
6969
'name' => $this->get_full_name(),
7070
'value' => $data,
7171
'size' => $this->size,
7272
'id' => $this->get_id(),
7373
'class' => 'form-control text-ltr',
74-
);
74+
];
7575

76-
$element = \html_writer::start_tag('div', array('class' => 'form-text defaultsnext'));
76+
$element = \html_writer::start_tag('div', ['class' => 'form-text defaultsnext']);
7777
$element .= \html_writer::empty_tag('input', $inputparams);
78-
$element .= \html_writer::start_tag('datalist', array('id' => $this->get_full_name()));
78+
$element .= \html_writer::start_tag('datalist', ['id' => $this->get_full_name()]);
7979
foreach ($options as $option) {
80-
$element .= \html_writer::tag('option', $option['label'], array('value' => $option['value']));
80+
$element .= \html_writer::tag('option', $option['label'], ['value' => $option['value']]);
8181
}
8282
$element .= \html_writer::end_tag('datalist');
8383
$element .= \html_writer::end_tag('div');

lang/en/tool_objectfs.php

Lines changed: 215 additions & 253 deletions
Large diffs are not rendered by default.

tests/check/tagging_migration_status_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3232
* @covers \tool_objectfs\check\tagging_migration_status
3333
*/
34-
class tagging_migration_status_test extends testcase {
34+
final class tagging_migration_status_test extends testcase {
3535
/**
3636
* Tests scenario that returns N/A
3737
*/
38-
public function test_get_result_na() {
38+
public function test_get_result_na(): void {
3939
// Regardless if this is disabled, the check should still return a non n/a status.
4040
$this->enable_filesystem_and_set_tagging(false);
4141
$check = new tagging_migration_status();
@@ -45,7 +45,7 @@ public function test_get_result_na() {
4545
/*
4646
* Test scenario that returns WARNING
4747
*/
48-
public function test_get_result_warning() {
48+
public function test_get_result_warning(): void {
4949
// Regardless if this is disabled, the check should still return a non n/a status.
5050
$this->enable_filesystem_and_set_tagging(false);
5151

@@ -60,7 +60,7 @@ public function test_get_result_warning() {
6060
/*
6161
* Test scenario that returns OK
6262
*/
63-
public function test_get_result_ok() {
63+
public function test_get_result_ok(): void {
6464
// Regardless if this is disabled, the check should still return a non n/a status.
6565
$this->enable_filesystem_and_set_tagging(false);
6666

tests/check/tagging_sync_status_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3131
* @covers \tool_objectfs\check\tagging_sync_status
3232
*/
33-
class tagging_sync_status_test extends testcase {
33+
final class tagging_sync_status_test extends testcase {
3434
/**
3535
* Tests scenario that returns N/A
3636
*/
37-
public function test_get_result_na() {
37+
public function test_get_result_na(): void {
3838
// Not enabled by default, should return N/A.
3939
$check = new tagging_sync_status();
4040
$this->assertEquals(result::NA, $check->get_result()->get_status());
@@ -43,7 +43,7 @@ public function test_get_result_na() {
4343
/**
4444
* Test scenario that returns OK
4545
*/
46-
public function test_get_result_ok() {
46+
public function test_get_result_ok(): void {
4747
$this->enable_filesystem_and_set_tagging(true);
4848
$object = $this->create_remote_object();
4949
tag_manager::mark_object_tag_sync_status($object->contenthash, tag_manager::SYNC_STATUS_COMPLETE);
@@ -56,7 +56,7 @@ public function test_get_result_ok() {
5656
/**
5757
* Tests scenario that returns WARNING
5858
*/
59-
public function test_get_result_warning() {
59+
public function test_get_result_warning(): void {
6060
$this->enable_filesystem_and_set_tagging(true);
6161
$object = $this->create_remote_object();
6262
tag_manager::mark_object_tag_sync_status($object->contenthash, tag_manager::SYNC_STATUS_ERROR);

tests/local/manager_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @covers \tool_objectfs\local\manager
3333
*/
34-
class manager_test extends \tool_objectfs\tests\testcase {
34+
final class manager_test extends \tool_objectfs\tests\testcase {
3535

3636
/**
3737
* Data provider for test_all_extensions_whitelisted().
@@ -57,7 +57,7 @@ public static function all_extensions_whitelisted_provider(): array {
5757
* @param bool $result Expected result
5858
* @throws \dml_exception
5959
*/
60-
public function test_all_extensions_whitelisted($signingwhitelist, $result) {
60+
public function test_all_extensions_whitelisted($signingwhitelist, $result): void {
6161
if (isset($signingwhitelist)) {
6262
set_config('signingwhitelist', $signingwhitelist, 'tool_objectfs');
6363
}
@@ -91,7 +91,7 @@ public static function is_extension_whitelisted_provider(): array {
9191
* @param bool $result Expected result
9292
* @throws \dml_exception
9393
*/
94-
public function test_is_extension_whitelisted($signingwhitelist, $filename, $result) {
94+
public function test_is_extension_whitelisted($signingwhitelist, $filename, $result): void {
9595
if (isset($signingwhitelist)) {
9696
set_config('signingwhitelist', $signingwhitelist, 'tool_objectfs');
9797
}
@@ -129,7 +129,7 @@ public static function get_header_provider(): array {
129129
* @param string $search What we are searching for
130130
* @param bool $expected Expected result
131131
*/
132-
public function test_get_header($headers, $search, $expected) {
132+
public function test_get_header($headers, $search, $expected): void {
133133
$actual = manager::get_header($headers, $search);
134134
$this->assertEquals($expected, $actual);
135135
}

tests/local/object_manipulator/checker_test.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @copyright Catalyst IT
2727
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
*/
29-
class checker_test extends \tool_objectfs\tests\testcase {
29+
final class checker_test extends \tool_objectfs\tests\testcase {
3030

3131
/** @var string $manipulator */
3232
protected $manipulator = checker::class;
@@ -45,33 +45,34 @@ protected function setUp(): void {
4545

4646
protected function tearDown(): void {
4747
ob_end_clean();
48+
parent::tearDown();
4849
}
4950

50-
public function test_checker_get_location_local_if_object_is_local() {
51+
public function test_checker_get_location_local_if_object_is_local(): void {
5152
global $DB;
5253
$file = $this->create_local_object();
5354
$location = $DB->get_field('tool_objectfs_objects', 'location', ['contenthash' => $file->contenthash]);
5455
$this->assertEquals('string', gettype($location));
5556
$this->assertEquals(OBJECT_LOCATION_LOCAL, $location);
5657
}
5758

58-
public function test_checker_get_location_duplicated_if_object_is_duplicated() {
59+
public function test_checker_get_location_duplicated_if_object_is_duplicated(): void {
5960
global $DB;
6061
$file = $this->create_duplicated_object();
6162
$location = $DB->get_field('tool_objectfs_objects', 'location', ['contenthash' => $file->contenthash]);
6263
$this->assertEquals('string', gettype($location));
6364
$this->assertEquals(OBJECT_LOCATION_DUPLICATED, $location);
6465
}
6566

66-
public function test_checker_get_location_external_if_object_is_external() {
67+
public function test_checker_get_location_external_if_object_is_external(): void {
6768
global $DB;
6869
$file = $this->create_remote_object();
6970
$location = $DB->get_field('tool_objectfs_objects', 'location', ['contenthash' => $file->contenthash]);
7071
$this->assertEquals('string', gettype($location));
7172
$this->assertEquals(OBJECT_LOCATION_EXTERNAL, $location);
7273
}
7374

74-
public function test_checker_get_candidate_objects_will_not_get_objects() {
75+
public function test_checker_get_candidate_objects_will_not_get_objects(): void {
7576
$localobject = $this->create_local_object('test_checker_get_candidate_objects_will_not_get_objects_local');
7677
$remoteobject = $this->create_remote_object('test_checker_get_candidate_objects_will_not_get_objects_remote');
7778
$duplicatedbject = $this->create_duplicated_object('test_checker_get_candidate_objects_will_not_get_objects_duplicated');
@@ -81,15 +82,15 @@ public function test_checker_get_candidate_objects_will_not_get_objects() {
8182
self::assertFalse($this->objects_contain_hash($duplicatedbject->contenthash));
8283
}
8384

84-
public function test_checker_get_candidate_objects_will_get_object() {
85+
public function test_checker_get_candidate_objects_will_get_object(): void {
8586
global $DB;
8687
$localobject = $this->create_local_object('test_checker_get_candidate_objects_will_get_object');
8788
$DB->delete_records('tool_objectfs_objects', ['contenthash' => $localobject->contenthash]);
8889

8990
self::assertTrue($this->objects_contain_hash($localobject->contenthash));
9091
}
9192

92-
public function test_checker_can_update_object() {
93+
public function test_checker_can_update_object(): void {
9394
global $DB;
9495
$localobject = $this->create_local_object('test_checker_can_update_object');
9596
$localobject->id = null;
@@ -102,28 +103,28 @@ public function test_checker_can_update_object() {
102103
self::assertFalse($this->objects_contain_hash($localobject->contenthash));
103104
}
104105

105-
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_local() {
106+
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_local(): void {
106107
$file = $this->create_local_object();
107108
$reflection = new \ReflectionMethod(checker::class, "manipulate_object");
108109
$reflection->setAccessible(true);
109110
$this->assertEquals(OBJECT_LOCATION_LOCAL, $reflection->invokeArgs($this->checker, [$file]));
110111
}
111112

112-
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_duplicated() {
113+
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_duplicated(): void {
113114
$file = $this->create_duplicated_object();
114115
$reflection = new \ReflectionMethod(checker::class, "manipulate_object");
115116
$reflection->setAccessible(true);
116117
$this->assertEquals(OBJECT_LOCATION_DUPLICATED, $reflection->invokeArgs($this->checker, [$file]));
117118
}
118119

119-
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_external() {
120+
public function test_checker_manipulate_object_method_will_get_correct_location_if_file_is_external(): void {
120121
$file = $this->create_remote_object();
121122
$reflection = new \ReflectionMethod(checker::class, "manipulate_object");
122123
$reflection->setAccessible(true);
123124
$this->assertEquals(OBJECT_LOCATION_EXTERNAL, $reflection->invokeArgs($this->checker, [$file]));
124125
}
125126

126-
public function test_checker_manipulate_object_method_will_get_error_location_on_error_file() {
127+
public function test_checker_manipulate_object_method_will_get_error_location_on_error_file(): void {
127128
$file = $this->create_error_object();
128129
$reflection = new \ReflectionMethod(checker::class, "manipulate_object");
129130
$reflection->setAccessible(true);

tests/local/object_manipulator/deleter_test.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @copyright Catalyst IT
2727
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
*/
29-
class deleter_test extends \tool_objectfs\tests\testcase {
29+
final class deleter_test extends \tool_objectfs\tests\testcase {
3030

3131
/** @var string $manipulator */
3232
protected $manipulator = deleter::class;
@@ -48,6 +48,7 @@ protected function setUp(): void {
4848

4949
protected function tearDown(): void {
5050
ob_end_clean();
51+
parent::tearDown();
5152
}
5253

5354
/**
@@ -64,28 +65,28 @@ protected function set_deleter_config($key, $value) {
6465
$this->deleter = new deleter($this->filesystem, $config, $this->logger);
6566
}
6667

67-
public function test_deleter_get_candidate_objects_will_get_duplicated_objects() {
68+
public function test_deleter_get_candidate_objects_will_get_duplicated_objects(): void {
6869
$duplicatedbject = $this->create_duplicated_object();
6970

7071
self::assertTrue($this->objects_contain_hash($duplicatedbject->contenthash));
7172
}
7273

73-
public function test_deleter_get_candidate_objects_will_not_get_local_or_remote_objects() {
74+
public function test_deleter_get_candidate_objects_will_not_get_local_or_remote_objects(): void {
7475
$localobject = $this->create_local_object();
7576
$remoteobject = $this->create_remote_object();
7677

7778
self::assertFalse($this->objects_contain_hash($localobject->contenthash));
7879
self::assertFalse($this->objects_contain_hash($remoteobject->contenthash));
7980
}
8081

81-
public function test_deleter_get_candidate_objects_will_not_get_objects_which_havent_been_duplicated_for_consistancy_delay() {
82+
public function test_deleter_get_candidate_objects_will_not_get_objects_which_havent_been_duplicated_for_consistancy_delay(): void {
8283
$duplicatedbject = $this->create_duplicated_object();
8384
$this->set_deleter_config('consistencydelay', 100);
8485

8586
self::assertFalse($this->objects_contain_hash($duplicatedbject->contenthash));
8687
}
8788

88-
public function test_deleter_can_delete_object() {
89+
public function test_deleter_can_delete_object(): void {
8990
global $DB;
9091
$object = $this->create_duplicated_object();
9192

@@ -97,7 +98,7 @@ public function test_deleter_can_delete_object() {
9798
$this->assertTrue($this->is_externally_readable_by_hash($object->contenthash));
9899
}
99100

100-
public function test_deleter_can_handle_local_object() {
101+
public function test_deleter_can_handle_local_object(): void {
101102
global $DB;
102103
$object = $this->create_local_object();
103104

@@ -109,7 +110,7 @@ public function test_deleter_can_handle_local_object() {
109110
$this->assertFalse($this->is_externally_readable_by_hash($object->contenthash));
110111
}
111112

112-
public function test_deleter_can_handle_remote_object() {
113+
public function test_deleter_can_handle_remote_object(): void {
113114
global $DB;
114115
$object = $this->create_remote_object();
115116

@@ -121,7 +122,7 @@ public function test_deleter_can_handle_remote_object() {
121122
$this->assertTrue($this->is_externally_readable_by_hash($object->contenthash));
122123
}
123124

124-
public function test_deleter_will_delete_no_objects_if_deletelocal_disabled() {
125+
public function test_deleter_will_delete_no_objects_if_deletelocal_disabled(): void {
125126
global $DB;
126127
$object = $this->create_duplicated_object();
127128
$this->set_deleter_config('deletelocal', 0);
@@ -134,7 +135,7 @@ public function test_deleter_will_delete_no_objects_if_deletelocal_disabled() {
134135
$this->assertTrue($this->is_externally_readable_by_hash($object->contenthash));
135136
}
136137

137-
public function test_deleter_can_delete_multiple_objects() {
138+
public function test_deleter_can_delete_multiple_objects(): void {
138139
global $DB;
139140
$objects = [];
140141
for ($i = 0; $i < 5; $i++) {

tests/local/object_manipulator/orphaner_test.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @copyright Catalyst IT
2828
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2929
*/
30-
class orphaner_test extends \tool_objectfs\tests\testcase {
30+
final class orphaner_test extends \tool_objectfs\tests\testcase {
3131

3232
/** @var string $manipulator */
3333
protected $manipulator = orphaner::class;
@@ -48,6 +48,7 @@ protected function setUp(): void {
4848

4949
protected function tearDown(): void {
5050
ob_end_clean();
51+
parent::tearDown();
5152
}
5253

5354
/**
@@ -64,7 +65,7 @@ protected function set_orphaner_config($key, $value) {
6465
$this->orphaner = new orphaner($this->filesystem, $config, $this->logger);
6566
}
6667

67-
public function test_orphaner_can_orphan_files() {
68+
public function test_orphaner_can_orphan_files(): void {
6869
global $DB;
6970
$this->orphaner->execute([
7071
$object1 = $this->create_local_object(),
@@ -79,7 +80,7 @@ public function test_orphaner_can_orphan_files() {
7980
$this->assertEquals(OBJECT_LOCATION_ORPHANED, $location3);
8081
}
8182

82-
public function test_orphaner_finds_correct_candidates() {
83+
public function test_orphaner_finds_correct_candidates(): void {
8384
global $DB;
8485

8586
// Initialise the candidate finder.
@@ -110,7 +111,7 @@ public function test_orphaner_finds_correct_candidates() {
110111
$this->assertCount(0, $objects); // No candidates - only candidate has been orphaned.
111112
}
112113

113-
public function test_orphaner_correctly_orphans_provided_files() {
114+
public function test_orphaner_correctly_orphans_provided_files(): void {
114115
global $DB;
115116
$this->orphaner->execute([
116117
$object1 = $this->create_local_object(),

0 commit comments

Comments
 (0)