]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove all uses of numRows().
authorAndreas Fischer <bantu@owncloud.com>
Tue, 17 Dec 2013 00:28:05 +0000 (01:28 +0100)
committerAndreas Fischer <bantu@owncloud.com>
Sat, 21 Dec 2013 18:56:14 +0000 (19:56 +0100)
tests/lib/db.php
tests/lib/dbschema.php
tests/lib/preferences.php

index 96d5f873b5c0c3dbdb63998d1962c5954241db0e..f0b271a36f1e7b71dd56f495e98b91f0e5fff618 100644 (file)
@@ -137,10 +137,10 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array($uri));
                $this->assertTrue((bool)$result);
-               $row = $result->fetchRow();
-               $this->assertArrayHasKey('carddata', $row);
-               $this->assertEquals($carddata, $row['carddata']);
-               $this->assertEquals(1, $result->numRows());
+               $rowset = $result->fetchAll();
+               $this->assertEquals(1, count($rowset));
+               $this->assertArrayHasKey('carddata', $rowset[0]);
+               $this->assertEquals($carddata, $rowset[0]['carddata']);
 
                // Try to insert a new row
                $result = OC_DB::insertIfNotExist('*PREFIX*'.$this->table2,
@@ -153,13 +153,12 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array($uri));
                $this->assertTrue((bool)$result);
-               $row = $result->fetchRow();
-               $this->assertArrayHasKey('carddata', $row);
                // Test that previously inserted data isn't overwritten
-               $this->assertEquals($carddata, $row['carddata']);
                // And that a new row hasn't been inserted.
-               $this->assertEquals(1, $result->numRows());
-
+               $rowset = $result->fetchAll();
+               $this->assertEquals(1, count($rowset));
+               $this->assertArrayHasKey('carddata', $rowset[0]);
+               $this->assertEquals($carddata, $rowset[0]['carddata']);
        }
 
        public function testUtf8Data() {
index 7de90c047caa091bb370e8a642f8933b835efa6c..4a7b7f7aac0ef4ecc70c7f78fa1de82acfdbab04 100644 (file)
@@ -103,7 +103,7 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
                                break;
                }
                
-               $name = $result->fetchOne(); //FIXME checking with '$result->numRows() === 1' does not seem to work?
+               $name = $result->fetchOne();
                if ($name === $table) {
                        return true;
                } else {
index 68b794e9ea9526d574710d10552978a0c36efc24..a8236909dedd87a95eb6c4cc759e1f8f21d55d5b 100644 (file)
@@ -101,28 +101,28 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
                $this->assertTrue(\OC_Preferences::deleteKey('Deleteuser', 'deleteapp', 'deletekey'));
                $query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?');
                $result = $query->execute(array('Deleteuser', 'deleteapp', 'deletekey'));
-               $this->assertEquals(0, $result->numRows());
+               $this->assertEquals(0, count($result->fetchAll()));
        }
 
        public function testDeleteApp() {
                $this->assertTrue(\OC_Preferences::deleteApp('Deleteuser', 'deleteapp'));
                $query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ? AND `appid` = ?');
                $result = $query->execute(array('Deleteuser', 'deleteapp'));
-               $this->assertEquals(0, $result->numRows());
+               $this->assertEquals(0, count($result->fetchAll()));
        }
 
        public function testDeleteUser() {
                $this->assertTrue(\OC_Preferences::deleteUser('Deleteuser'));
                $query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?');
                $result = $query->execute(array('Deleteuser'));
-               $this->assertEquals(0, $result->numRows());
+               $this->assertEquals(0, count($result->fetchAll()));
        }
 
        public function testDeleteAppFromAllUsers() {
                $this->assertTrue(\OC_Preferences::deleteAppFromAllUsers('someapp'));
                $query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `appid` = ?');
                $result = $query->execute(array('someapp'));
-               $this->assertEquals(0, $result->numRows());
+               $this->assertEquals(0, count($result->fetchAll()));
        }
 }