File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
tests/phpunit/tests/privacy Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1111 * Test cases for `wp_privacy_delete_old_export_files()`.
1212 *
1313 * @group privacy
14- * @covers wp_privacy_delete_old_export_files
14+ * @covers :: wp_privacy_delete_old_export_files
1515 *
1616 * @since 4.9.6
1717 */
@@ -143,4 +143,30 @@ public function test_index_file_should_never_be_deleted() {
143143
144144 $ this ->assertTrue ( file_exists ( self ::$ index_path ) );
145145 }
146+
147+ /**
148+ * Test the correct files are deleted when the expiration time is filtered.
149+ *
150+ * @since 4.9.9
151+ */
152+ public function test_filtered_expiration_time () {
153+ add_filter ( 'wp_privacy_export_expiration ' , array ( $ this , 'filter_export_file_expiration_time ' ) );
154+
155+ wp_privacy_delete_old_export_files ();
156+ $ this ->assertTrue ( file_exists ( self ::$ active_export_file ) );
157+ $ this ->assertTrue ( file_exists ( self ::$ expired_export_file ) );
158+
159+ remove_filter ( 'wp_privacy_export_expiration ' , array ( $ this , 'filter_export_file_expiration_time ' ) );
160+ }
161+
162+ /**
163+ * Filters the expiration time for export files.
164+ *
165+ * @since 4.9.9
166+ *
167+ * @return int New, longer expiration time.
168+ */
169+ public function filter_export_file_expiration_time () {
170+ return 6 * DAY_IN_SECONDS ;
171+ }
146172}
You can’t perform that action at this time.
0 commit comments