From: Roland Häder Date: Mon, 20 Jun 2022 06:18:53 +0000 (+0200) Subject: Changed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6743de63f5d0d276d6ee6bfa0d065b7f289f48ac;p=friendica.git Changed: - DBA::exists() should only be used for checking if records exists. - if you want to check if a table exists, please ALWAYS use DBStructure::existsTable() instead --- diff --git a/src/Database/DBA.php b/src/Database/DBA.php index d7c0421b7a..e519a63cd6 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -218,8 +218,8 @@ class DBA /** * Check if data exists * - * @param string|array $table Table name or array [schema => table] - * @param array $condition array of fields for condition + * @param string|array $table Table name or array [schema => table] + * @param array $condition array of fields for condition * @return boolean Are there rows for that condition? * @throws \Exception */ diff --git a/tests/src/Database/DBATest.php b/tests/src/Database/DBATest.php index c92133ac54..febe9c8c62 100644 --- a/tests/src/Database/DBATest.php +++ b/tests/src/Database/DBATest.php @@ -55,9 +55,6 @@ class DBATest extends DatabaseTest self::assertTrue(DBA::exists('config', [])); self::assertFalse(DBA::exists('notable', [])); - self::assertTrue(DBA::exists('config', null)); - self::assertFalse(DBA::exists('notable', null)); - self::assertTrue(DBA::exists('config', ['k' => 'hostname'])); self::assertFalse(DBA::exists('config', ['k' => 'nonsense'])); } diff --git a/tests/src/Database/DBStructureTest.php b/tests/src/Database/DBStructureTest.php index 638a98ed7a..613e2f7832 100644 --- a/tests/src/Database/DBStructureTest.php +++ b/tests/src/Database/DBStructureTest.php @@ -45,7 +45,6 @@ class DBStructureTest extends DatabaseTest */ public function testExists() { self::assertTrue(DBStructure::existsTable('config')); - self::assertFalse(DBStructure::existsTable('notatable')); self::assertTrue(DBStructure::existsColumn('config', ['k']));