diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-12-23 03:38:56 -0800 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-12-23 03:38:56 -0800 |
commit | 7b428f6009f61bad0f1ab49a83fefdd3ff2d2ce6 (patch) | |
tree | 80fbde8b9c43c5162bda2bac6b6a060bab071658 /tests/lib | |
parent | f60ecfc7fd127b412f0aa5134ae2e6d976997ad9 (diff) | |
parent | 4bc2a22317dd65f142cf697cd10ed6920d930544 (diff) | |
download | nextcloud-server-7b428f6009f61bad0f1ab49a83fefdd3ff2d2ce6.tar.gz nextcloud-server-7b428f6009f61bad0f1ab49a83fefdd3ff2d2ce6.zip |
Merge pull request #6460 from owncloud/remove-numRows
Remove OC_DB_StatementWrapper::numRows()
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/db.php | 17 | ||||
-rw-r--r-- | tests/lib/dbschema.php | 2 | ||||
-rw-r--r-- | tests/lib/preferences.php | 8 |
3 files changed, 13 insertions, 14 deletions
diff --git a/tests/lib/db.php b/tests/lib/db.php index 96d5f873b5c..f0b271a36f1 100644 --- a/tests/lib/db.php +++ b/tests/lib/db.php @@ -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() { diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index 7de90c047ca..4a7b7f7aac0 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -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 { diff --git a/tests/lib/preferences.php b/tests/lib/preferences.php index 68b794e9ea9..a8236909ded 100644 --- a/tests/lib/preferences.php +++ b/tests/lib/preferences.php @@ -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())); } } |