From 77374ae03c568030373f57d57bd7f30cd7d55588 Mon Sep 17 00:00:00 2001 From: Achim Ennenbach <achim@simsync.de> Date: Fri, 8 Feb 2019 21:17:29 +0100 Subject: [PATCH] fixed typo in testUpdate() Added additional assertion in testInsert() --- tests/unit/e_db_mysqlTest.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/unit/e_db_mysqlTest.php b/tests/unit/e_db_mysqlTest.php index 900e53f7d..d3d360092 100644 --- a/tests/unit/e_db_mysqlTest.php +++ b/tests/unit/e_db_mysqlTest.php @@ -245,8 +245,16 @@ */ public function testInsert() { - $actual = $this->db->insert('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => time(), 'tmp_info' => 'Insert test')); + $actual = $this->db->insert('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => '12345435', 'tmp_info' => 'Insert test')); $this->assertEquals(1, $actual, 'Unable to add record to table #tmp'); + + $expected = array( + 'tmp_ip' => '127.0.0.1', + 'tmp_time' => '12345435', + 'tmp_info' => 'Insert test' + ); + $actual = $this->db->retrieve('tmp', '*','tmp_ip = "127.0.0.1" AND tmp_time = 12345435'); + $this->assertEquals($expected, $actual, 'Inserted content doesn\'t match the retrieved content'); } /* public function testLastInsertId() @@ -293,11 +301,11 @@ // Test 2 $db->insert('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => time(), 'tmp_info' => 'test 2')); $expected = $db->update('tmp', array('tmp_ip' => '127.0.0.1', 'tmp_time' => time(), 'tmp_info' => 'Update test 2a', 'WHERE' => 'tmp_ip="127.0.0.1"')); - $this->assertEquals($actual, $expected, "Test 2 update() failed ({$actual} != {$expected}"); + $this->assertEquals($expected, $actual, "Test 2 update() failed ({$actual} != {$expected}"); // Test 3 $expected = $db->update('tmp', 'tmp_ip = "127.0.0.1", tmp_time = tmp_time + 1, tmp_info = "Update test 3" WHERE tmp_ip="127.0.0.1"'); - $this->assertEquals($actual, $expected, "Test 3 update() failed ({$actual} != {$expected}"); + $this->assertEquals($expected, $actual, "Test 3 update() failed ({$actual} != {$expected}"); } /*