@@ -77,7 +77,7 @@ public function test_tag_sources_identifier(tag_source $source) {
77
77
*/
78
78
public function test_tag_sources_value (tag_source $ source ) {
79
79
// Ensure tag value is < 128 chars, AWS & Azure spec allow for 256, but we reserve 128 for future use.
80
- $ file = $ this ->create_duplicated_object ();
80
+ $ file = $ this ->create_duplicated_object (' tag source value test ' . $ source -> get_identifier () );
81
81
$ value = $ source ->get_value_for_contenthash ($ file ->contenthash );
82
82
83
83
// Null value - allowed, but means we cannot test.
@@ -90,9 +90,6 @@ public function test_tag_sources_value(tag_source $source) {
90
90
$ this ->assertGreaterThan (0 , $ count );
91
91
}
92
92
93
- // TODO ensure all sources have unique keys.
94
- // TODO ensure keys and values are all strings.
95
-
96
93
/**
97
94
* Provides values to test_is_tagging_enabled_and_supported
98
95
* @return array
@@ -141,8 +138,12 @@ public function test_is_tagging_enabled_and_supported(bool $enabledinconfig, boo
141
138
$ this ->assertEquals ($ expected , tag_manager::is_tagging_enabled_and_supported ());
142
139
}
143
140
141
+ /**
142
+ * Tests gather_object_tags_for_upload
143
+ * @covers \tool_objectfs\local\tag_manager::gather_object_tags_for_upload
144
+ */
144
145
public function test_gather_object_tags_for_upload () {
145
- $ object = $ this ->create_duplicated_object ();
146
+ $ object = $ this ->create_duplicated_object (' gather tags for upload test ' );
146
147
$ tags = tag_manager::gather_object_tags_for_upload ($ object ->contenthash );
147
148
148
149
$ this ->assertArrayHasKey ('mimetype ' , $ tags );
@@ -151,6 +152,10 @@ public function test_gather_object_tags_for_upload() {
151
152
$ this ->assertEquals ('test ' , $ tags ['environment ' ]);
152
153
}
153
154
155
+ /**
156
+ * Tests store_tags_locally
157
+ * @covers \tool_objectfs\local\tag_manager::store_tags_locally
158
+ */
154
159
public function test_store_tags_locally () {
155
160
global $ DB ;
156
161
@@ -228,13 +233,13 @@ public function test_get_objects_needing_sync(int $location, int $syncstatus, bo
228
233
// Create the test object at the required location.
229
234
switch ($ location ) {
230
235
case OBJECT_LOCATION_DUPLICATED :
231
- $ object = $ this ->create_duplicated_object ();
236
+ $ object = $ this ->create_duplicated_object (' tagging test object duplicated ' );
232
237
break ;
233
238
case OBJECT_LOCATION_LOCAL :
234
- $ object = $ this ->create_local_object ();
239
+ $ object = $ this ->create_local_object (' tagging test object local ' );
235
240
break ;
236
241
case OBJECT_LOCATION_EXTERNAL :
237
- $ object = $ this ->create_remote_object ();
242
+ $ object = $ this ->create_remote_object (' tagging test object remote ' );
238
243
break ;
239
244
default :
240
245
throw new coding_exception ("Object location not handled in test " );
@@ -261,16 +266,20 @@ public function test_get_objects_needing_sync_limit() {
261
266
global $ DB ;
262
267
263
268
// Create two duplicated objects needing sync.
264
- $ object = $ this ->create_duplicated_object ();
269
+ $ object = $ this ->create_duplicated_object (' sync limit test duplicated ' );
265
270
$ DB ->set_field ('tool_objectfs_objects ' , 'tagsyncstatus ' , tag_manager::SYNC_STATUS_NEEDS_SYNC , ['id ' => $ object ->id ]);
266
- $ object = $ this ->create_remote_object ();
271
+ $ object = $ this ->create_remote_object (' sync limit test remote ' );
267
272
$ DB ->set_field ('tool_objectfs_objects ' , 'tagsyncstatus ' , tag_manager::SYNC_STATUS_NEEDS_SYNC , ['id ' => $ object ->id ]);
268
273
269
274
// Ensure a limit of 2 returns 2, and limit of 1 returns 1.
270
275
$ this ->assertCount (2 , tag_manager::get_objects_needing_sync (2 ));
271
276
$ this ->assertCount (1 , tag_manager::get_objects_needing_sync (1 ));
272
277
}
273
278
279
+ /**
280
+ * Test get_tag_summary_html
281
+ * @covers \tool_objectfs\local\tag_manager::get_tag_summary_html
282
+ */
274
283
public function test_get_tag_summary_html () {
275
284
// Quick test just to ensure it generates and nothing explodes.
276
285
$ html = tag_manager::get_tag_summary_html ();
0 commit comments