diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2018-01-22 22:59:13 +0100 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2018-01-28 23:02:46 +0100 |
commit | 4bf0c9e36a4a89d6b84c6bf8a74124603add9d9e (patch) | |
tree | 944e77b4cd6ab8df8cc0a6908407bedb7756bcc2 /tests | |
parent | 509844fd7e08ebccec4d924845d0f2a60f5768e5 (diff) | |
download | volse-hubzilla-4bf0c9e36a4a89d6b84c6bf8a74124603add9d9e.tar.gz volse-hubzilla-4bf0c9e36a4a89d6b84c6bf8a74124603add9d9e.tar.bz2 volse-hubzilla-4bf0c9e36a4a89d6b84c6bf8a74124603add9d9e.zip |
:white_check_mark: Add tests for non existent tables.
Prevent PHP warnings "Undefined variable" in dba_pdo::q();
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/includes/dba/dba_pdoTest.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/includes/dba/dba_pdoTest.php b/tests/unit/includes/dba/dba_pdoTest.php index ce6e1ffd6..12e574d42 100644 --- a/tests/unit/includes/dba/dba_pdoTest.php +++ b/tests/unit/includes/dba/dba_pdoTest.php @@ -164,4 +164,26 @@ class dba_pdoTest extends DatabaseTestCase { $this->assertFalse($nodba->q('SELECT * FROM account')); } + /** + * @depends testConnectToSqlServer + */ + public function testSelectQueryToNonExistentTableShouldReturnFalse() { + $ret = $this->dba->q('SELECT * FROM non_existent_table'); + + $this->assertFalse($ret); + } + + /** + * @depends testConnectToSqlServer + */ + public function testInsertQueryToNonExistentTableShouldReturnEmptyArray() { + $ret = $this->dba->q('INSERT INTO non_existent_table + (account_email, account_language) + VALUES (\'email@example.com\', \'en\') + '); + + $this->assertNotInstanceOf('PDOStatement', $ret); + $this->isEmpty($ret); + } + } |