Skip to content

Commit 17c6d04

Browse files
authored
Bug fix: Prevent fatal if class does not exist (#200)
* Prevent fatal if class does not exist * Fix e2e plugin activation on outdated versions
1 parent 2475c85 commit 17c6d04

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

includes/admin/beta-features.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function __construct() {
4747
* @return void
4848
*/
4949
public function register_beta_feature( $beta_feature ) {
50+
if ( ! class_exists( $beta_feature ) ) {
51+
return;
52+
}
53+
5054
$instance = new $beta_feature();
5155
$this->beta_features[ $instance->name ] = $instance;
5256
}

tests/e2e/plugin-activation.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ test.describe( 'Plugin Activation', () => {
2323
// Navigate to plugins page
2424
await admin.visitAdminPage( 'plugins.php' );
2525

26-
// Check if our plugin is active
27-
const pluginRow = page.locator( `tr[data-plugin="${ PLUGIN_PATH }"]` );
26+
// Check if our plugin is active (exclude update notification rows)
27+
const pluginRow = page.locator( `tr[data-plugin="${ PLUGIN_PATH }"]:not(.plugin-update-tr)` );
2828
await expect( pluginRow ).toBeVisible();
2929

3030
// Check if plugin is activated
@@ -38,9 +38,9 @@ test.describe( 'Plugin Activation', () => {
3838
// Navigate to plugins page
3939
await admin.visitAdminPage( 'plugins.php' );
4040

41-
// Check plugin name
41+
// Check plugin name (exclude update notification rows)
4242
const pluginName = page.locator(
43-
`tr[data-plugin="${ PLUGIN_PATH }"] .plugin-title strong`
43+
`tr[data-plugin="${ PLUGIN_PATH }"]:not(.plugin-update-tr) .plugin-title strong`
4444
);
4545
await expect( pluginName ).toHaveText( 'Secure Custom Fields' );
4646
} );

0 commit comments

Comments
 (0)