diff options
Diffstat (limited to 'tests/lib/AppFramework/Db/MapperTest.php')
-rw-r--r-- | tests/lib/AppFramework/Db/MapperTest.php | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php index 79a9a1884e0..4509b1b80c7 100644 --- a/tests/lib/AppFramework/Db/MapperTest.php +++ b/tests/lib/AppFramework/Db/MapperTest.php @@ -44,12 +44,12 @@ class Example extends Entity { class ExampleMapper extends Mapper { - 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); } - public function mapRow($row){ return $this->mapRowToEntity($row); } - public function execSql($sql, $params){ return $this->execute($sql, $params); } + 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); } + public function mapRow($row) { return $this->mapRowToEntity($row); } + public function execSql($sql, $params) { return $this->execute($sql, $params); } } @@ -66,12 +66,12 @@ class MapperTest extends MapperTestUtility { } - public function testMapperShouldSetTableName(){ + public function testMapperShouldSetTableName() { $this->assertEquals('*PREFIX*table', $this->mapper->getTableName()); } - public function testFindQuery(){ + public function testFindQuery() { $sql = 'hi'; $params = ['jo']; $rows = [ @@ -81,7 +81,7 @@ class MapperTest extends MapperTestUtility { $this->mapper->find($sql, $params); } - public function testFindEntity(){ + public function testFindEntity() { $sql = 'hi'; $params = ['jo']; $rows = [ @@ -91,7 +91,7 @@ class MapperTest extends MapperTestUtility { $this->mapper->findOneEntity($sql, $params); } - public function testFindNotFound(){ + public function testFindNotFound() { $sql = 'hi'; $params = ['jo']; $rows = []; @@ -100,7 +100,7 @@ class MapperTest extends MapperTestUtility { $this->mapper->find($sql, $params); } - public function testFindEntityNotFound(){ + public function testFindEntityNotFound() { $sql = 'hi'; $params = ['jo']; $rows = []; @@ -109,7 +109,7 @@ class MapperTest extends MapperTestUtility { $this->mapper->findOneEntity($sql, $params); } - public function testFindMultiple(){ + public function testFindMultiple() { $sql = 'hi'; $params = ['jo']; $rows = [ @@ -120,7 +120,7 @@ class MapperTest extends MapperTestUtility { $this->mapper->find($sql, $params); } - public function testFindEntityMultiple(){ + public function testFindEntityMultiple() { $sql = 'hi'; $params = ['jo']; $rows = [ @@ -132,7 +132,7 @@ class MapperTest extends MapperTestUtility { } - public function testDelete(){ + public function testDelete() { $sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?'; $params = [2]; @@ -144,7 +144,7 @@ class MapperTest extends MapperTestUtility { } - public function testCreate(){ + public function testCreate() { $this->db->expects($this->once()) ->method('lastInsertId') ->with($this->equalTo('*PREFIX*table')) @@ -164,7 +164,7 @@ class MapperTest extends MapperTestUtility { } - public function testCreateShouldReturnItemWithCorrectInsertId(){ + public function testCreateShouldReturnItemWithCorrectInsertId() { $this->db->expects($this->once()) ->method('lastInsertId') ->with($this->equalTo('*PREFIX*table')) @@ -195,7 +195,7 @@ class MapperTest extends MapperTestUtility { } - public function testUpdate(){ + public function testUpdate() { $sql = 'UPDATE `*PREFIX*table` ' . 'SET ' . '`pre_name` = ?,'. @@ -214,7 +214,7 @@ class MapperTest extends MapperTestUtility { } - public function testUpdateNoId(){ + public function testUpdateNoId() { $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); @@ -226,7 +226,7 @@ class MapperTest extends MapperTestUtility { } - public function testUpdateNothingChangedNoQuery(){ + public function testUpdateNothingChangedNoQuery() { $params = ['john', 'my@email']; $entity = new Example(); $entity->setId(3); @@ -240,7 +240,7 @@ class MapperTest extends MapperTestUtility { } - public function testMapRowToEntity(){ + public function testMapRowToEntity() { $entity1 = $this->mapper->mapRow(['pre_name' => 'test1', 'email' => 'test2']); $entity2 = new Example(); $entity2->setPreName('test1'); @@ -249,7 +249,7 @@ class MapperTest extends MapperTestUtility { $this->assertEquals($entity2, $entity1); } - public function testFindEntities(){ + public function testFindEntities() { $sql = 'hi'; $rows = [ ['pre_name' => 'hi'] @@ -262,7 +262,7 @@ class MapperTest extends MapperTestUtility { $this->assertEquals([$entity], $result); } - public function testFindEntitiesNotFound(){ + public function testFindEntitiesNotFound() { $sql = 'hi'; $rows = []; $this->setMapperResult($sql, [], $rows); @@ -270,7 +270,7 @@ class MapperTest extends MapperTestUtility { $this->assertEquals([], $result); } - public function testFindEntitiesMultiple(){ + public function testFindEntitiesMultiple() { $sql = 'hi'; $rows = [ ['pre_name' => 'jo'], ['email' => 'ho'] |