diff options
author | LEDfan <tobia@ledfan.be> | 2016-02-11 10:07:01 +0300 |
---|---|---|
committer | LEDfan <tobia@ledfan.be> | 2016-02-11 10:07:01 +0300 |
commit | 653d612e1a6d09567b58ff530caa2a61aa4d2dd0 (patch) | |
tree | ea2d76f7c1c86e35e77c6794af5cd5a7a2509537 /utility/mappertestutility.php | |
parent | 9dd41c3241942f5de0040daa6f86d73075f5d46b (diff) |
Add presence
- automatically go offline
- don't use memcache for now
- broadcast presence when someone changes his
- add unit and integration tests
- add newContentContainer to easily add extra stanzas to the response
- do not return the presence of other users to a user which set his
presence to unavailable
- improve README's in code
- add some caches to PresenceMapper to prevent that presence is fetched
multiple times from the DB in the same request
Diffstat (limited to 'utility/mappertestutility.php')
-rw-r--r-- | utility/mappertestutility.php | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/utility/mappertestutility.php b/utility/mappertestutility.php index 0a705ce..ae72c5b 100644 --- a/utility/mappertestutility.php +++ b/utility/mappertestutility.php @@ -2,10 +2,8 @@ namespace OCA\OJSXC\Utility; -use Test\TestCase; use OCA\OJSXC\AppInfo\Application; - /** * @group DB */ @@ -20,12 +18,26 @@ class MapperTestUtility extends TestCase { protected $mapperName; + protected $host; + + protected $userId; + protected function setUp() { parent::setUp(); $app = new Application(); + $this->overwriteApplicationService($app, 'Host','localhost'); + $this->overwriteApplicationService($app, 'UserId', 'admin'); $this->container = $app->getContainer(); $this->mapper = $this->container[$this->mapperName]; + $this->host = 'localhost'; + $this->userId = 'admin'; + + $con = $this->container->getServer()->getDatabaseConnection(); + $con->executeQuery('DELETE FROM ' . $this->mapper->getTableName()); + } + + protected function tearDown() { $con = $this->container->getServer()->getDatabaseConnection(); $con->executeQuery('DELETE FROM ' . $this->mapper->getTableName()); } @@ -43,4 +55,27 @@ class MapperTestUtility extends TestCase { return $entities; } + + protected function fetchAllAsArray($tableName = null){ + if (is_null($tableName)) { + $tableName = $this->mapper->getTableName(); + } else { + } + $con = $this->container->getServer()->getDatabaseConnection(); + $stmt = $con->executeQuery('SELECT * FROM ' . $tableName); + + $result = []; + while($row = $stmt->fetch()){ + $result[] = $row; + } + $stmt->closeCursor(); + + return $result; + } + + public function getLastInsertedId() { + return $this->container->getServer()->getDatabaseConnection()->lastInsertId(); + + } + }
\ No newline at end of file |