summaryrefslogtreecommitdiffstats
path: root/tests/lib/appframework/db/mappertest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/appframework/db/mappertest.php')
-rw-r--r--tests/lib/appframework/db/mappertest.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/lib/appframework/db/mappertest.php b/tests/lib/appframework/db/mappertest.php
index 6ad8cd86bff..8e585c479bb 100644
--- a/tests/lib/appframework/db/mappertest.php
+++ b/tests/lib/appframework/db/mappertest.php
@@ -24,7 +24,7 @@
namespace OCP\AppFramework\Db;
-use \OCP\IDb;
+use \OCP\IDBConnection;
use Test\AppFramework\Db\MapperTestUtility;
/**
@@ -42,7 +42,7 @@ class Example extends Entity {
class ExampleMapper extends Mapper {
- public function __construct(IDb $db){ parent::__construct($db, 'table'); }
+ public function __construct(IDBConnection $db){ parent::__construct($db, 'table'); }
public function find($table, $id){ return $this->findOneQuery($table, $id); }
public function findOneEntity($table, $id){ return $this->findEntity($table, $id); }
public function findAllEntities($table){ return $this->findEntities($table); }
@@ -74,7 +74,7 @@ class MapperTest extends MapperTestUtility {
$rows = array(
array('hi')
);
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows);
$this->mapper->find($sql, $params);
}
@@ -84,7 +84,7 @@ class MapperTest extends MapperTestUtility {
$rows = array(
array('pre_name' => 'hi')
);
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows, null, null, true);
$this->mapper->findOneEntity($sql, $params);
}
@@ -92,7 +92,7 @@ class MapperTest extends MapperTestUtility {
$sql = 'hi';
$params = array('jo');
$rows = array();
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows);
$this->setExpectedException(
'\OCP\AppFramework\Db\DoesNotExistException');
$this->mapper->find($sql, $params);
@@ -102,7 +102,7 @@ class MapperTest extends MapperTestUtility {
$sql = 'hi';
$params = array('jo');
$rows = array();
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows, null, null, true);
$this->setExpectedException(
'\OCP\AppFramework\Db\DoesNotExistException');
$this->mapper->findOneEntity($sql, $params);
@@ -114,7 +114,7 @@ class MapperTest extends MapperTestUtility {
$rows = array(
array('jo'), array('ho')
);
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows, null, null, true);
$this->setExpectedException(
'\OCP\AppFramework\Db\MultipleObjectsReturnedException');
$this->mapper->find($sql, $params);
@@ -126,7 +126,7 @@ class MapperTest extends MapperTestUtility {
$rows = array(
array('jo'), array('ho')
);
- $this->setMapperResult($sql, $params, $rows);
+ $this->setMapperResult($sql, $params, $rows, null, null, true);
$this->setExpectedException(
'\OCP\AppFramework\Db\MultipleObjectsReturnedException');
$this->mapper->findOneEntity($sql, $params);
@@ -137,7 +137,7 @@ class MapperTest extends MapperTestUtility {
$sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?';
$params = array(2);
- $this->setMapperResult($sql, $params);
+ $this->setMapperResult($sql, $params, [], null, null, true);
$entity = new Example();
$entity->setId($params[0]);
@@ -147,7 +147,7 @@ class MapperTest extends MapperTestUtility {
public function testCreate(){
$this->db->expects($this->once())
- ->method('getInsertId')
+ ->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
->will($this->returnValue(3));
$this->mapper = new ExampleMapper($this->db);
@@ -159,7 +159,7 @@ class MapperTest extends MapperTestUtility {
$entity->setPreName($params[0]);
$entity->setEmail($params[1]);
- $this->setMapperResult($sql, $params);
+ $this->setMapperResult($sql, $params, [], null, null, true);
$this->mapper->insert($entity);
}
@@ -167,7 +167,7 @@ class MapperTest extends MapperTestUtility {
public function testCreateShouldReturnItemWithCorrectInsertId(){
$this->db->expects($this->once())
- ->method('getInsertId')
+ ->method('lastInsertId')
->with($this->equalTo('*PREFIX*table'))
->will($this->returnValue(3));
$this->mapper = new ExampleMapper($this->db);
@@ -200,7 +200,7 @@ class MapperTest extends MapperTestUtility {
$entity->setEmail($params[1]);
$entity->setId($params[2]);
- $this->setMapperResult($sql, $params);
+ $this->setMapperResult($sql, $params, [], null, null, true);
$this->mapper->update($entity);
}
@@ -249,7 +249,7 @@ class MapperTest extends MapperTestUtility {
$entity = new Example();
$entity->setPreName('hi');
$entity->resetUpdatedFields();
- $this->setMapperResult($sql, array(), $rows);
+ $this->setMapperResult($sql, array(), $rows, null, null, true);
$result = $this->mapper->findAllEntities($sql);
$this->assertEquals(array($entity), $result);
}