From e8338602b78127f1eefbe15560da8b41a68c7803 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 16 Apr 2025 08:45:01 +0200 Subject: [PATCH 1/3] fix class-query.php path --- uninstall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uninstall.php b/uninstall.php index 6f10a63ed..edecdca6c 100644 --- a/uninstall.php +++ b/uninstall.php @@ -13,7 +13,7 @@ } require_once __DIR__ . '/classes/class-settings.php'; -require_once __DIR__ . '/classes/class-query.php'; +require_once __DIR__ . '/classes/activities/class-query.php'; /** * Delete the plugin options. From 49c3578b40cbd1d9c6c1820399746e5d1ecbfcf8 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 16 Apr 2025 09:48:18 +0200 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6735529c9..cbe887612 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ += 1.3.0 = + +Bugs we fixed: + +* Fixed error during plugin uninstall. + = 1.2.1 = Enhancements: From 7ca3d8c0dfe20bbfd8e216c3c1ee57d7760246ce Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 16 Apr 2025 10:32:27 +0200 Subject: [PATCH 3/3] add uninstall test --- tests/phpunit/test-class-uninstall.php | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tests/phpunit/test-class-uninstall.php diff --git a/tests/phpunit/test-class-uninstall.php b/tests/phpunit/test-class-uninstall.php new file mode 100644 index 000000000..60d648fbc --- /dev/null +++ b/tests/phpunit/test-class-uninstall.php @@ -0,0 +1,48 @@ +assertFileExists( $uninstall_file, 'Uninstall file does not exist.' ); + + // Catch fatal errors. + $errors = []; + set_error_handler( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_set_error_handler + function ( $errno, $errstr ) use ( &$errors ) { + $errors[] = "$errno: $errstr"; + return true; // prevent default error handler. + } + ); + + // Needed to simulate WordPress uninstall context. + define( 'WP_UNINSTALL_PLUGIN', true ); + + // Include the uninstall script. + try { + require $uninstall_file; + } catch ( \Throwable $e ) { + $this->fail( 'Fatal error during uninstall.php: ' . $e->getMessage() ); + } + + restore_error_handler(); + + $this->assertEmpty( $errors, 'Uninstall file caused PHP warnings or errors: ' . implode( ', ', $errors ) ); + } +}