]> source.dussan.org Git - nextcloud-server.git/commitdiff
use assertEquals number of rows in db tests
authorJörn Friedrich Dreyer <jfd@butonic.de>
Thu, 20 Jun 2013 13:38:02 +0000 (15:38 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 24 Jun 2013 14:29:59 +0000 (16:29 +0200)
tests/lib/db.php

index afbdb413c3d7e61e64adcad3b7a2588d8cf98c6a..0ba7d5d4b0609c6ac1cbd8baccafd2f5707c08de 100644 (file)
@@ -40,7 +40,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                $this->assertFalse((bool)$row); //PDO returns false, MDB2 returns null
                $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)');
                $result = $query->execute(array('fullname test', 'uri_1'));
-               $this->assertTrue((bool)$result);
+               $this->assertEquals('1', $result);
                $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_1'));
                $this->assertTrue((bool)$result);
@@ -57,7 +57,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
        public function testNOW() {
                $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (NOW(),?)');
                $result = $query->execute(array('uri_2'));
-               $this->assertTrue((bool)$result);
+               $this->assertEquals('1', $result);
                $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_2'));
                $this->assertTrue((bool)$result);
@@ -66,7 +66,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
        public function testUNIX_TIMESTAMP() {
                $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)');
                $result = $query->execute(array('uri_3'));
-               $this->assertTrue((bool)$result);
+               $this->assertEquals('1', $result);
                $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_3'));
                $this->assertTrue((bool)$result);
@@ -105,7 +105,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                // Normal test to have same known data inserted.
                $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)');
                $result = $query->execute(array($fullname, $uri, $carddata));
-               $this->assertTrue((bool)$result);
+               $this->assertEquals('1', $result);
                $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array($uri));
                $this->assertTrue((bool)$result);