From a60894f1d6ef33613d2d0351075aa07aa257f304 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 1 Aug 2019 03:15:47 +0200 Subject: [PATCH] Continued: - configKey's value should be string here - word "method" is better describing - rewrote single-line to multi-line - added internal TODO MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../lfdb_legacy/class_CachedLocalFileDatabase.php | 9 ++++++++- ...class_TestConfigurationLoadableClassesFilter.php | 13 ++++++++++--- .../bootstrap/class_FrameworkBootstrapTest.php | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php index dd8c3356..2e47f6fb 100644 --- a/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php +++ b/framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php @@ -490,7 +490,13 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac $this->setLastException($e); // Throw an SQL exception - throw new SqlException(array($this, sprintf('Cannot write data to table '%s', is the table created?', $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY); + throw new SqlException(array( + $this, + sprintf('Cannot write data to table '%s', is the table created?', $dataSetInstance->getTableName()), + self::DB_CODE_TABLE_UNWRITEABLE + ), + self::EXCEPTION_SQL_QUERY + ); } } @@ -609,6 +615,7 @@ class CachedLocalFileDatabase extends BaseDatabaseBackend implements DatabaseBac * * @param $tableName Name of the table we need the primary key from * @return $primaryKey Primary key column of the given table + * @todo Rename method to getPrimaryKeyFromTableInfo() */ public function getPrimaryKeyOfTable ($tableName) { // Default key is null diff --git a/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php b/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php index e46919ab..78ef7288 100644 --- a/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php +++ b/framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php @@ -83,15 +83,22 @@ class TestConfigurationLoadableClassesFilter extends BaseTestsFilter implements // This may throw exceptions try { - // Is the class there? - if (!class_exists($configValue)) { + // Is the config entry valid and class is there? + if (!is_string($configKey)) { + // Is not a string + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('configKey=%s has unexpected type "%s". FAILED', $configKey, gettype($configKey))); + + // Skip further tests + $failed++; + continue; + } elseif (!class_exists($configValue)) { // Class not found self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" not found. FAILED', $configValue)); // Skip further tests $failed++; continue; - } // END - if + } } catch (InvalidArgumentException $e) { // Maybe not conform? self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('Class "%s" failed to load. Message: "%s"', $configValue, $e->getMessage())); diff --git a/tests/framework/bootstrap/class_FrameworkBootstrapTest.php b/tests/framework/bootstrap/class_FrameworkBootstrapTest.php index e96065a5..89d796ea 100644 --- a/tests/framework/bootstrap/class_FrameworkBootstrapTest.php +++ b/tests/framework/bootstrap/class_FrameworkBootstrapTest.php @@ -201,7 +201,7 @@ class FrameworkBootstrapTest extends TestCase { /** * Re-tests if detectServerAddress() is returning what it should for tests. - * This will always be 127.0.0.1. This call should not invoke + * This will always be 127.0.0.1. This method should not invoke * ConsoleTools's method as the configuration entry is already cached. */ public function testConfigDetectServerAddressCached () { -- 2.30.2