1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-01-21 17:52:10 +01:00
OwncloudBookmarksOfficial/tests/publiccontroller_test.php
ganomi ae81b9dcd2 This is a refactored / rewritten version of the bookmarks app using the app frameworks design and controller features.
Dependency Injection for user and db is used througout the controllers
The Routing features a consistent rest api
The Routing provides some legacy routes, so that for exampe the Android Bookmarks App still works.

There is a publicly available api that provides access to bookmarks per user.
(This is usefull in connection with the WP Plugin https://github.com/mario-nolte/oc2wp-bookmarks)
2014-11-26 12:24:18 +01:00

38 lines
1.0 KiB
PHP

<?php
OC_App::loadApp('bookmarks');
use \OCA\Bookmarks\Controller\Rest\PublicController;
class Test_PublicController_Bookmarks extends PHPUnit_Framework_TestCase {
private $userid;
private $request;
private $db;
private $userManager;
private $publicController;
protected function setUp() {
$this->userid = "testuser";
$this->request = \OC::$server->getRequest();
$this->db = \OC::$server->getDb();
$this->userManager = \OC::$server->getUserManager();
$this->publicController = new PublicController("bookmarks", $this->request, $this->db, $this->userManager);
}
function testPublicQueryNoUser() {
$output = $this->publicController->returnAsJson(null, "apassword", null);
$data = $output->getData();
$status = $data['status'];
$this->assertEquals($status, 'error');
}
function testPublicQueryWrongUser() {
$output = $this->publicController->returnAsJson("cqc43dr4rx3x4xatr4", "apassword", null);
$data = $output->getData();
$status = $data['status'];
$this->assertEquals($status, 'error');
}
}