aboutsummaryrefslogtreecommitdiffstats
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.php80
1 files changed, 40 insertions, 40 deletions
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php
index 67d88c879a3..79a9a1884e0 100644
--- a/tests/lib/AppFramework/Db/MapperTest.php
+++ b/tests/lib/AppFramework/Db/MapperTest.php
@@ -73,28 +73,28 @@ class MapperTest extends MapperTestUtility {
public function testFindQuery(){
$sql = 'hi';
- $params = array('jo');
- $rows = array(
- array('hi')
- );
+ $params = ['jo'];
+ $rows = [
+ ['hi']
+ ];
$this->setMapperResult($sql, $params, $rows);
$this->mapper->find($sql, $params);
}
public function testFindEntity(){
$sql = 'hi';
- $params = array('jo');
- $rows = array(
- array('pre_name' => 'hi')
- );
+ $params = ['jo'];
+ $rows = [
+ ['pre_name' => 'hi']
+ ];
$this->setMapperResult($sql, $params, $rows, null, null, true);
$this->mapper->findOneEntity($sql, $params);
}
public function testFindNotFound(){
$sql = 'hi';
- $params = array('jo');
- $rows = array();
+ $params = ['jo'];
+ $rows = [];
$this->setMapperResult($sql, $params, $rows);
$this->expectException(DoesNotExistException::class);
$this->mapper->find($sql, $params);
@@ -102,8 +102,8 @@ class MapperTest extends MapperTestUtility {
public function testFindEntityNotFound(){
$sql = 'hi';
- $params = array('jo');
- $rows = array();
+ $params = ['jo'];
+ $rows = [];
$this->setMapperResult($sql, $params, $rows, null, null, true);
$this->expectException(DoesNotExistException::class);
$this->mapper->findOneEntity($sql, $params);
@@ -111,10 +111,10 @@ class MapperTest extends MapperTestUtility {
public function testFindMultiple(){
$sql = 'hi';
- $params = array('jo');
- $rows = array(
- array('jo'), array('ho')
- );
+ $params = ['jo'];
+ $rows = [
+ ['jo'], ['ho']
+ ];
$this->setMapperResult($sql, $params, $rows, null, null, true);
$this->expectException(MultipleObjectsReturnedException::class);
$this->mapper->find($sql, $params);
@@ -122,10 +122,10 @@ class MapperTest extends MapperTestUtility {
public function testFindEntityMultiple(){
$sql = 'hi';
- $params = array('jo');
- $rows = array(
- array('jo'), array('ho')
- );
+ $params = ['jo'];
+ $rows = [
+ ['jo'], ['ho']
+ ];
$this->setMapperResult($sql, $params, $rows, null, null, true);
$this->expectException(MultipleObjectsReturnedException::class);
$this->mapper->findOneEntity($sql, $params);
@@ -134,7 +134,7 @@ class MapperTest extends MapperTestUtility {
public function testDelete(){
$sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?';
- $params = array(2);
+ $params = [2];
$this->setMapperResult($sql, $params, [], null, null, true);
$entity = new Example();
@@ -153,7 +153,7 @@ class MapperTest extends MapperTestUtility {
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
'VALUES(?,?)';
- $params = array('john', 'my@email');
+ $params = ['john', 'my@email'];
$entity = new Example();
$entity->setPreName($params[0]);
$entity->setEmail($params[1]);
@@ -173,7 +173,7 @@ class MapperTest extends MapperTestUtility {
$sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' .
'VALUES(?,?)';
- $params = array('john', 'my@email');
+ $params = ['john', 'my@email'];
$entity = new Example();
$entity->setPreName($params[0]);
$entity->setEmail($params[1]);
@@ -202,7 +202,7 @@ class MapperTest extends MapperTestUtility {
'`email` = ? ' .
'WHERE `id` = ?';
- $params = array('john', 'my@email', 1);
+ $params = ['john', 'my@email', 1];
$entity = new Example();
$entity->setPreName($params[0]);
$entity->setEmail($params[1]);
@@ -215,7 +215,7 @@ class MapperTest extends MapperTestUtility {
public function testUpdateNoId(){
- $params = array('john', 'my@email');
+ $params = ['john', 'my@email'];
$entity = new Example();
$entity->setPreName($params[0]);
$entity->setEmail($params[1]);
@@ -227,7 +227,7 @@ class MapperTest extends MapperTestUtility {
public function testUpdateNothingChangedNoQuery(){
- $params = array('john', 'my@email');
+ $params = ['john', 'my@email'];
$entity = new Example();
$entity->setId(3);
$entity->setEmail($params[1]);
@@ -241,7 +241,7 @@ class MapperTest extends MapperTestUtility {
public function testMapRowToEntity(){
- $entity1 = $this->mapper->mapRow(array('pre_name' => 'test1', 'email' => 'test2'));
+ $entity1 = $this->mapper->mapRow(['pre_name' => 'test1', 'email' => 'test2']);
$entity2 = new Example();
$entity2->setPreName('test1');
$entity2->setEmail('test2');
@@ -251,38 +251,38 @@ class MapperTest extends MapperTestUtility {
public function testFindEntities(){
$sql = 'hi';
- $rows = array(
- array('pre_name' => 'hi')
- );
+ $rows = [
+ ['pre_name' => 'hi']
+ ];
$entity = new Example();
$entity->setPreName('hi');
$entity->resetUpdatedFields();
- $this->setMapperResult($sql, array(), $rows, null, null, true);
+ $this->setMapperResult($sql, [], $rows, null, null, true);
$result = $this->mapper->findAllEntities($sql);
- $this->assertEquals(array($entity), $result);
+ $this->assertEquals([$entity], $result);
}
public function testFindEntitiesNotFound(){
$sql = 'hi';
- $rows = array();
- $this->setMapperResult($sql, array(), $rows);
+ $rows = [];
+ $this->setMapperResult($sql, [], $rows);
$result = $this->mapper->findAllEntities($sql);
- $this->assertEquals(array(), $result);
+ $this->assertEquals([], $result);
}
public function testFindEntitiesMultiple(){
$sql = 'hi';
- $rows = array(
- array('pre_name' => 'jo'), array('email' => 'ho')
- );
+ $rows = [
+ ['pre_name' => 'jo'], ['email' => 'ho']
+ ];
$entity1 = new Example();
$entity1->setPreName('jo');
$entity1->resetUpdatedFields();
$entity2 = new Example();
$entity2->setEmail('ho');
$entity2->resetUpdatedFields();
- $this->setMapperResult($sql, array(), $rows);
+ $this->setMapperResult($sql, [], $rows);
$result = $this->mapper->findAllEntities($sql);
- $this->assertEquals(array($entity1, $entity2), $result);
+ $this->assertEquals([$entity1, $entity2], $result);
}
}