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 );
0 commit comments