From b0bc772181962c4a821f6277fc8a53e5ce641dd8 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Wed, 25 Dec 2024 00:48:12 -0800 Subject: [PATCH] fix uninstall e2e test failure --- tests/e2e-uninstall/get-matomo-tables.php | 6 ++++++ tests/e2e-uninstall/uninstall.e2e.ts | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/e2e-uninstall/get-matomo-tables.php b/tests/e2e-uninstall/get-matomo-tables.php index 2f5bf5030..87aa3c936 100644 --- a/tests/e2e-uninstall/get-matomo-tables.php +++ b/tests/e2e-uninstall/get-matomo-tables.php @@ -19,6 +19,11 @@ exit; } +$multi = isset( $_GET['multi'] ) ? ( (int) $_GET['multi'] ) : 0; +if ( $multi ) { + $dbname = preg_replace( '/_multi$/', '', $dbname ); +} + $pdo = new \PDO( "mysql:host=$host;dbname={$dbname}", 'root', 'pass' ); $query = $pdo->prepare( 'SHOW TABLES' ); $query->execute(); @@ -26,6 +31,7 @@ $tables = $query->fetchAll( \PDO::FETCH_COLUMN ); echo json_encode( [ + 'get' => $_GET, 'dbname' => $dbname, 'tables' => $tables, ] diff --git a/tests/e2e-uninstall/uninstall.e2e.ts b/tests/e2e-uninstall/uninstall.e2e.ts index cfd7dff44..a83aecf1d 100644 --- a/tests/e2e-uninstall/uninstall.e2e.ts +++ b/tests/e2e-uninstall/uninstall.e2e.ts @@ -16,8 +16,7 @@ describe('MWP Uninstall', () => { }); async function getTablesInstalled(): Promise { - console.log('root url: ' + `${await Website.rootUrl()}/matomo-for-wordpress/tests/e2e-uninstall/get-matomo-tables.php`); - let result: any = await fetch(`${await Website.rootUrl()}/matomo-for-wordpress/tests/e2e-uninstall/get-matomo-tables.php`); + let result: any = await fetch(`${await Website.rootUrl()}/matomo-for-wordpress/tests/e2e-uninstall/get-matomo-tables.php?multi=0`); result = await result.text(); try { result = JSON.parse(result); @@ -67,7 +66,7 @@ describe('MWP Uninstall', () => { expect(result.tables).toBeInstanceOf(Array); // sanity check console.log(`result.dbname is: ${result.dbname}`); - + console.log('result.get is', result.get); let tables = result.tables; tables = tables.filter((t: string) => t.includes('matomo')); expect(tables).toEqual([]); // check there are no tables with "matomo" in the name