Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 1 Aug 2019 01:15:47 +0000 (03:15 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 1 Aug 2019 02:35:38 +0000 (04:35 +0200)
- configKey's value should be string here
- word "method" is better describing
- rewrote single-line to multi-line
- added internal TODO

Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/database/backend/lfdb_legacy/class_CachedLocalFileDatabase.php
framework/main/tests/filter/tests/configuration/classes/class_TestConfigurationLoadableClassesFilter.php
tests/framework/bootstrap/class_FrameworkBootstrapTest.php

index dd8c335..2e47f6f 100644 (file)
@@ -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 &#39;%s&#39;, 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 &#39;%s&#39;, 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
index e46919a..78ef728 100644 (file)
@@ -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()));
index e96065a..89d796e 100644 (file)
@@ -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 () {