summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:32:36 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-21 16:32:36 +0100
commitac84b27965f5a1aec859e389f099fb844e33de46 (patch)
treec98d7aace90fcb442208349918a3e71cd9a7691a
parentf475d882d0a76908400e9857f7e8a4ae8ad8a752 (diff)
reorganize folder
-rw-r--r--backgroundjob/backgroundjob.php (renamed from lib/backgroundjob.php)0
-rw-r--r--db/feedmapper.php2
-rw-r--r--external/feed.php (renamed from external_api/feed.php)0
-rw-r--r--external/folder.php (renamed from external_api/folder.php)0
-rw-r--r--lib/api.php166
-rw-r--r--lib/controller.php108
-rw-r--r--lib/request.php83
-rw-r--r--lib/response.php218
-rw-r--r--lib/security.php104
-rw-r--r--search/search.php (renamed from lib/search.php)0
-rw-r--r--share/item.php (renamed from lib/share/item.php)0
-rw-r--r--templates/subscribe.php (renamed from subscribe.php)0
-rw-r--r--tests/bl/FeedBlTest.php80
-rw-r--r--tests/bl/FolderBlTest.php117
-rw-r--r--tests/db/FeedMapperTest.php2
-rw-r--r--utility/opmlexporter.php (renamed from opmlexporter.php)0
-rw-r--r--utility/utils.php (renamed from lib/utils.php)0
17 files changed, 125 insertions, 755 deletions
diff --git a/lib/backgroundjob.php b/backgroundjob/backgroundjob.php
index 098ff8393..098ff8393 100644
--- a/lib/backgroundjob.php
+++ b/backgroundjob/backgroundjob.php
diff --git a/db/feedmapper.php b/db/feedmapper.php
index 2f5a3d036..cf434257c 100644
--- a/db/feedmapper.php
+++ b/db/feedmapper.php
@@ -64,7 +64,7 @@ class FeedMapper extends NewsMapper {
public function findAllFromUser($userId){
- $sql = 'SELECT `feeds`.*, COUNT(`items`.`id`) AS unread_count ' .
+ $sql = 'SELECT `feeds`.*, COUNT(`items`.`id`) AS `unread_count` ' .
'FROM `*dbprefix*news_feeds` `feeds` ' .
'LEFT OUTER JOIN `*dbprefix*news_items` `items` ' .
'ON `feeds`.`id` = `items`.`feed_id` ' .
diff --git a/external_api/feed.php b/external/feed.php
index a56cd2253..a56cd2253 100644
--- a/external_api/feed.php
+++ b/external/feed.php
diff --git a/external_api/folder.php b/external/folder.php
index 68c8ff523..68c8ff523 100644
--- a/external_api/folder.php
+++ b/external/folder.php
diff --git a/lib/api.php b/lib/api.php
deleted file mode 100644
index 28f471207..000000000
--- a/lib/api.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-
-/**
-* ownCloud - App Template Example
-*
-* @author Bernhard Posselt
-* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-
-namespace OCA\News;
-
-/**
- * This is used to wrap the owncloud static api calls into an object to make the
- * code better abstractable for use in the dependency injection container
- *
- * Extend this to your needs
- */
-class API {
-
- private $appName;
-
- /**
- * @param string $appName: the name of your application
- */
- public function __construct($appName){
- $this->appName = $appName;
- }
-
-
- /**
- * @return the name of your application
- */
- public function getAppName(){
- return $this->appName;
- }
-
-
- /**
- * @return: the user id of the current user
- */
- public function getUserId(){
- return \OCP\USER::getUser();
- }
-
-
- /**
- * Sets the current navigation entry to the currently running app
- */
- public function activateNavigationEntry(){
- \OCP\App::setActiveNavigationEntry($this->appName);
- }
-
-
- /**
- * Adds a new javascript file
- * @param string $scriptName: the name of the javascript in js/
- * without the suffix
- */
- public function addScript($scriptName, $appName=null){
- if($appName === null ){
- $appName = $this->appName;
- }
- \OCP\Util::addScript($appName, $scriptName);
- }
-
-
- /**
- * Adds a new css file
- * @param string $styleName: the name of the css file in css/
- * without the suffix
- */
- public function addStyle($styleName){
- \OCP\Util::addStyle($this->appName, $styleName);
- }
-
-
- /**
- * @brief shorthand for addScript for files in the 3rdparty directory
- * @param string $name: the name of the file without the suffix
- */
- public function add3rdPartyScript($name){
- \OCP\Util::addScript($this->appName . '/3rdparty', $name);
- }
-
-
- /**
- * @brief shorthand for addStyle for files in the 3rdparty directory
- * @param string $name: the name of the file without the suffix
- */
- public function add3rdPartyStyle($name){
- \OCP\Util::addStyle($this->appName . '/3rdparty', $name);
- }
-
- /**
- * Looks up a systemwide defined value
- * @param string $key: the key of the value, under which it was saved
- * @return the saved value
- */
- public function getSystemValue($key){
- return \OCP\Config::getSystemValue($key, '');
- }
-
-
- /**
- * Sets a new systemwide value
- * @param string $key: the key of the value, under which will be saved
- * @param $value: the value that should be stored
- */
- public function setSystemValue($key, $value){
- return \OCP\Config::setSystemValue($key, $value);
- }
-
-
- /**
- * Shortcut for setting a user defined value
- * @param $key the key under which the value is being stored
- * @param $value the value that you want to store
- */
- public function setUserValue($key, $value){
- \OCP\Config::setUserValue($this->getUserId(), $this->appName, $key, $value);
- }
-
-
- /**
- * Shortcut for getting a user defined value
- * @param $key the key under which the value is being stored
- */
- public function getUserValue($key){
- return \OCP\Config::getUserValue($this->getUserId(), $this->appName, $key);
- }
-
-
- /**
- * Returns the translation object
- * @return the translation object
- */
- public function getTrans(){
- return \OC_L10N::get($this->appName);
- }
-
-
- public function getLocalFilePath($path){
- return \OC_Filesystem::getLocalFile($path);
- }
-
-
- public function openEventSource(){
- return new \OC_EventSource();
- }
-
-} \ No newline at end of file
diff --git a/lib/controller.php b/lib/controller.php
deleted file mode 100644
index 292e25a18..000000000
--- a/lib/controller.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/**
-* ownCloud - News app
-*
-* @author Bernhard Posselt
-* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
-*
-* This file is licensed under the Affero General Public License version 3 or later.
-* See the COPYING-README file
-*
-*/
-
-namespace OCA\News;
-
-class Controller {
-
- protected $userId;
- protected $appName;
- protected $request;
- protected $api;
- protected $trans;
-
- public function __construct($request, $api){
- $this->api = $api;
- $this->userId = $api->getUserId();
- $this->appName = $api->getAppName();
- $this->request = $request;
- $this->trans = $api->getTrans();
- }
-
-
- /**
- * @brief lets you access post and get parameters by the index
- * @param string $key: the key which you want to access in the $_POST or
- * $_GET array. If both arrays store things under the same
- * key, return the value in $_POST
- * @param $default: the value that is returned if the key does not exist
- * @return: the content of the array
- */
- protected function params($key, $default=null){
- $postValue = $this->request->getPOST($key);
- $getValue = $this->request->getGET($key);
-
- if($postValue !== null){
- return $postValue;
- }
-
- if($getValue !== null){
- return $getValue;
- }
-
- return $default;
- }
-
- /**
- * Shortcut for accessing an uploaded file through the $_FILES array
- * @param string $key: the key that will be taken from the $_FILES array
- * @return the file in the $_FILES element
- */
- protected function getUploadedFile($key){
- return $this->request->getFILES($key);
- }
-
-
- /**
- * Binds variables to the template and prints it
- * The following values are always assigned: userId, trans
- * @param $templateName the name of the template
- * @param $arguments an array with arguments in $templateVar => $content
- * @param string $renderAs: admin, user or blank: admin renders the page on
- * the admin settings page, user renders a normal
- * owncloud page, blank renders the template alone
- */
- protected function render($templateName, $arguments=array(),
- $renderAs='user'){
- $response = new TemplateResponse($this->appName, $templateName);
- $response->setParams($arguments);
- $response->renderAs($renderAs);
- return $response;
- }
-
-
- /**
- * @brief renders a json success
- * @param array $params an array which will be converted to JSON
- */
- protected function renderJSON($params=array()){
- $response = new JSONResponse($this->appName);
- $response->setParams($params);
- return $response;
- }
-
-
- /**
- * @brief renders a json error
- * @param string $msg: the error message
- * @param string $file: the file that it occured in
- * @param array $params an array which will be converted to JSON
- */
- protected function renderJSONError($msg, $file="", $params=array()){
- $response = new JSONResponse($this->appName);
- $response->setParams($params);
- $response->setErrorMessage($msg, $file);
- return $response;
- }
-
-
-}
diff --git a/lib/request.php b/lib/request.php
deleted file mode 100644
index 013c9b80e..000000000
--- a/lib/request.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
-* ownCloud - News app
-*
-* @author Bernhard Posselt
-* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
-*
-* This file is licensed under the Affero General Public License version 3 or later.
-* See the COPYING-README file
-*
-*/
-
-namespace OCA\News;
-
-
-/**
- * Encapsulates user id, $_GET and $_POST arrays for better testability
- */
-class Request {
-
- private $get;
- private $post;
- private $userId;
- private $files;
-
- /**
- * @param string $userId: the id of the current user
- * @param array $get: the $_GET array
- * @param array $post: the $_POST array
- * @param array $files the $_FILES array
- */
- public function __construct($userId, $get=array(), $post=array(), $files=array()) {
- $this->get = $get;
- $this->post = $post;
- $this->userId = $userId;
- $this->files = $files;
- }
-
-
- /**
- * Returns the get value or the default if not found
- * @param string $key: the array key that should be looked up
- * @param string $default: if the key is not found, return this value
- * @return the value of the stored array
- */
- public function getGET($key, $default=null){
- if(isset($this->get[$key])){
- return $this->get[$key];
- } else {
- return $default;
- }
- }
-
-
- /**
- * Returns the get value of the files array
- * @param string $key: the array key that should be looked up
- * @return the value of the stored array
- */
- public function getFILES($key){
- if(isset($this->files[$key])){
- return $this->files[$key];
- } else {
- return null;
- }
- }
-
-
- /**
- * Returns the get value or the default if not found
- * @param string $key: the array key that should be looked up
- * @param string $default: if the key is not found, return this value
- * @return the value of the stored array
- */
- public function getPOST($key, $default=null){
- if(isset($this->post[$key])){
- return $this->post[$key];
- } else {
- return $default;
- }
- }
-
-}
diff --git a/lib/response.php b/lib/response.php
deleted file mode 100644
index 993d061d3..000000000
--- a/lib/response.php
+++ /dev/null
@@ -1,218 +0,0 @@
-<?php
-/**
-* ownCloud - News app
-*
-* @author Bernhard Posselt
-* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
-*
-* This file is licensed under the Affero General Public License version 3 or later.
-* See the COPYING-README file
-*
-*/
-
-namespace OCA\News;
-
-
-abstract class Response {
-
- private $headers;
-
- protected function __construct(){
- $this->headers = array();
- }
-
- /**
- * Adds a new header to the response that will be called before the render
- * function
- * @param string header: the string that will be used in the header() function
- */
- public function addHeader($header){
- array_push($this->headers, $header);
- }
-
-
- /**
- * Renders all headers
- */
- public function render(){
- foreach($this->headers as $value) {
- header($value);
- }
- }
-
-
-}
-
-
-/**
- * Prompts the user to download the a textfile
- */
-class TextDownloadResponse extends Response {
-
- private $content;
- private $filename;
- private $contentType;
-
- /**
- * Creates a response that prompts the user to download the file
- * @param string $content: the content that should be written into the file
- * @param string $filename: the name that the downloaded file should have
- * @param string $contentType: the mimetype that the downloaded file should have
- */
- public function __construct($content, $filename, $contentType){
- parent::__construct();
- $this->content = $content;
- $this->filename = $filename;
- $this->contentType = $contentType;
-
- $this->addHeader('Content-Disposition: attachment; filename="' . $filename . '"');
- $this->addHeader('Content-Type: ' . $contentType);
- }
-
-
- /**
- * Simply sets the headers and returns the file contents
- * @return the file contents
- */
- public function render(){
- parent::render();
- return $this->content;
- }
-
-
-}
-
-
-/**
- * Response for a normal template
- */
-class TemplateResponse extends Response {
-
- private $templateName;
- private $params;
- private $appName;
- private $renderAs;
-
- /**
- * @param string $appName: the name of your app
- * @param string $templateName: the name of the template
- */
- public function __construct($appName, $templateName) {
- parent::__construct();
- $this->templateName = $templateName;
- $this->appName = $appName;
- $this->params = array();
- $this->renderAs = 'user';
- }
-
-
- /**
- * @brief sets template parameters
- * @param array $params: an array with key => value structure which sets template
- * variables
- */
- public function setParams($params){
- $this->params = $params;
- }
-
-
- /**
- * @brief sets the template page
- * @param string $renderAs: admin, user or blank: admin renders the page on
- * the admin settings page, user renders a normal
- * owncloud page, blank renders the template alone
- */
- public function renderAs($renderAs='user'){
- $this->renderAs = $renderAs;
- }
-
-
- /**
- * Returns the rendered html
- * @return the rendered html
- */
- public function render(){
- parent::render();
-
- if($this->renderAs === 'blank'){
- $template = new \OCP\Template($this->appName, $this->templateName);
- } else {
- $template = new \OCP\Template($this->appName, $this->templateName,
- $this->renderAs);
- }
-
- foreach($this->params as $key => $value){
- $template->assign($key, $value, false);
- }
-
- return $template->fetchPage();
- }
-
-}
-
-
-/**
- * A renderer for JSON calls
- */
-class JSONResponse extends Response {
-
- private $name;
- private $data;
- private $appName;
-
- /**
- * @param string $appName: the name of your app
- */
- public function __construct($appName) {
- parent::__construct();
- $this->appName = $appName;
- $this->data = array();
- $this->error = false;
- }
-
- /**
- * @brief sets values in the data json array
- * @param array $params: an array with key => value structure which will be
- * transformed to JSON
- */
- public function setParams($params){
- $this->data['data'] = $params;
- }
-
-
- /**
- * @brief in case we want to render an error message, also logs into the
- * owncloud log
- * @param string $message: the error message
- * @param string $file: the file where the error occured, use __FILE__ in
- * the file where you call it
- */
- public function setErrorMessage($msg, $file){
- $this->error = true;
- $this->data['msg'] = $msg;
- \OCP\Util::writeLog($this->appName, $file . ': ' . $msg, \OCP\Util::ERROR);
- }
-
-
- /**
- * Returns the rendered json
- * @return the rendered json
- */
- public function render(){
- parent::render();
-
- ob_start();
-
- if($this->error){
- \OCP\JSON::error($this->data);
- } else {
- \OCP\JSON::success($this->data);
- }
-
- $result = ob_get_contents();
- ob_end_clean();
-
- return $result;
- }
-
-} \ No newline at end of file
diff --git a/lib/security.php b/lib/security.php
deleted file mode 100644
index 99258285c..000000000
--- a/lib/security.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/**
-* ownCloud - News app
-*
-* @author Bernhard Posselt
-* Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
-*
-* This file is licensed under the Affero General Public License version 3 or later.
-* See the COPYING-README file
-*
-*/
-
-
-namespace OCA\News;
-
-
-/**
- * This class is a simple object with getters and setters and allows
- * finegrained controll over security checks
- * All security checks are enabled by default
- */
-class Security {
-
- private $csrfCheck;
- private $loggedInCheck;
- private $appEnabledCheck;
- private $isAdminCheck;
- private $appName;
-
- /**
- * @param string $appName: the name of the app
- */
- public function __construct($appName){
- $this->appName = $appName;
-
- // enable all checks by default
- $this->csrfCheck = true;
- $this->loggedInCheck = true;
- $this->appEnabledCheck = true;
- $this->isAdminCheck = true;
- }
-
-
- public function setCSRFCheck($csrfCheck){
- $this->csrfCheck = $csrfCheck;
- }
-
- public function setLoggedInCheck($loggedInCheck){
- $this->loggedInCheck = $loggedInCheck;
- }
-
- public function setAppEnabledCheck($appEnabledCheck){
- $this->appEnabledCheck = $appEnabledCheck;
- }
-
- public function setIsAdminCheck($isAdminCheck){
- $this->isAdminCheck = $isAdminCheck;
- }
-
-
- /**
- * Runs all security checks
- */
- public function runChecks() {
-
- if($this->loggedInCheck){
- \OCP\JSON::checkLoggedIn();
- }
-
- if($this->appEnabledCheck){
- \OCP\JSON::checkAppEnabled($this->appName);
- }
-
- if($this->isAdminCheck){
- \OCP\JSON::checkAdminUser();
- }
-
- }
-
-
- /**
- * Runs all the security checks for AJAX requests
- */
- public function runAjaxChecks(){
- if($this->csrfCheck){
- \OCP\JSON::callCheck();
- }
-
- if($this->loggedInCheck){
- \OCP\JSON::checkLoggedIn();
- }
-
- if($this->appEnabledCheck){
- \OCP\JSON::checkAppEnabled($this->appName);
- }
-
- if($this->isAdminCheck){
- \OCP\JSON::checkAdminUser();
- }
-
- }
-
-
-} \ No newline at end of file
diff --git a/lib/search.php b/search/search.php
index d9cf1d294..d9cf1d294 100644
--- a/lib/search.php
+++ b/search/search.php
diff --git a/lib/share/item.php b/share/item.php
index db9ab0f48..db9ab0f48 100644
--- a/lib/share/item.php
+++ b/share/item.php
diff --git a/subscribe.php b/templates/subscribe.php
index 41f00e98e..41f00e98e 100644
--- a/subscribe.php
+++ b/templates/subscribe.php
diff --git a/tests/bl/FeedBlTest.php b/tests/bl/FeedBlTest.php
index dca99c682..31c8ff8d4 100644
--- a/tests/bl/FeedBlTest.php
+++ b/tests/bl/FeedBlTest.php
@@ -28,90 +28,22 @@ namespace OCA\News\Bl;
require_once(__DIR__ . "/../classloader.php");
-use \OCA\News\Db\Folder;
+use \OCA\News\Db\Feed;
-class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility {
+class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility {
protected $api;
- protected $folderMapper;
+ protected $feedMapper;
protected $folderBl;
protected function setUp(){
$this->api = $this->getAPIMock();
- $this->folderMapper = $this->getMock(
+ $this->feedMapper = $this->getMock(
'\OCA\News\Db\NewsMapper',
array('findAllFromUser', 'insert', 'update', 'find'),
array($this->api, 'test'));
- $this->folderBl = new FolderBl($this->folderMapper);
+ $this->folderBl = new FolderBl($this->feedMapper);
}
-
- function testFindAll(){
- $userId = 'jack';
- $return = 'hi';
- $this->folderMapper->expects($this->once())
- ->method('findAllFromUser')
- ->with($this->equalTo($userId))
- ->will($this->returnValue($return));
-
- $result = $this->folderBl->findAll($userId);
-
- $this->assertEquals($return, $result);
- }
-
-
- public function testCreate(){
- $folder = new Folder();
- $folder->setName('hey');
- $folder->setParentId(5);
-
- $this->folderMapper->expects($this->once())
- ->method('insert')
- ->with($this->equalTo($folder))
- ->will($this->returnValue($folder));
-
- $result = $this->folderBl->create('hey', 5);
-
- $this->assertEquals($folder, $result);
- }
-
-
- public function testSetOpened(){
- $folder = new Folder();
-
- $this->folderMapper->expects($this->once())
- ->method('find')
- ->with($this->equalTo(3))
- ->will($this->returnValue($folder));
-
- $this->folderMapper->expects($this->once())
- ->method('update')
- ->with($this->equalTo($folder));
-
- $this->folderBl->setOpened(3, false, '');
-
- $this->assertFalse($folder->getOpened());
-
- }
-
-
- public function testRename(){
- $folder = new Folder();
- $folder->setName('jooohn');
-
- $this->folderMapper->expects($this->once())
- ->method('find')
- ->with($this->equalTo(3))
- ->will($this->returnValue($folder));
-
- $this->folderMapper->expects($this->once())
- ->method('update')
- ->with($this->equalTo($folder));
-
- $this->folderBl->rename(3, 'bogus', '');
-
- $this->assertEquals('bogus', $folder->getName());
- }
-
-}
+} \ No newline at end of file
diff --git a/tests/bl/FolderBlTest.php b/tests/bl/FolderBlTest.php
new file mode 100644
index 000000000..dca99c682
--- /dev/null
+++ b/tests/bl/FolderBlTest.php
@@ -0,0 +1,117 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Cosentino
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace OCA\News\Bl;
+
+require_once(__DIR__ . "/../classloader.php");
+
+
+use \OCA\News\Db\Folder;
+
+
+class FolderBlTest extends \OCA\AppFramework\Utility\TestUtility {
+
+ protected $api;
+ protected $folderMapper;
+ protected $folderBl;
+
+ protected function setUp(){
+ $this->api = $this->getAPIMock();
+ $this->folderMapper = $this->getMock(
+ '\OCA\News\Db\NewsMapper',
+ array('findAllFromUser', 'insert', 'update', 'find'),
+ array($this->api, 'test'));
+ $this->folderBl = new FolderBl($this->folderMapper);
+ }
+
+
+ function testFindAll(){
+ $userId = 'jack';
+ $return = 'hi';
+ $this->folderMapper->expects($this->once())
+ ->method('findAllFromUser')
+ ->with($this->equalTo($userId))
+ ->will($this->returnValue($return));
+
+ $result = $this->folderBl->findAll($userId);
+
+ $this->assertEquals($return, $result);
+ }
+
+
+ public function testCreate(){
+ $folder = new Folder();
+ $folder->setName('hey');
+ $folder->setParentId(5);
+
+ $this->folderMapper->expects($this->once())
+ ->method('insert')
+ ->with($this->equalTo($folder))
+ ->will($this->returnValue($folder));
+
+ $result = $this->folderBl->create('hey', 5);
+
+ $this->assertEquals($folder, $result);
+ }
+
+
+ public function testSetOpened(){
+ $folder = new Folder();
+
+ $this->folderMapper->expects($this->once())
+ ->method('find')
+ ->with($this->equalTo(3))
+ ->will($this->returnValue($folder));
+
+ $this->folderMapper->expects($this->once())
+ ->method('update')
+ ->with($this->equalTo($folder));
+
+ $this->folderBl->setOpened(3, false, '');
+
+ $this->assertFalse($folder->getOpened());
+
+ }
+
+
+ public function testRename(){
+ $folder = new Folder();
+ $folder->setName('jooohn');
+
+ $this->folderMapper->expects($this->once())
+ ->method('find')
+ ->with($this->equalTo(3))
+ ->will($this->returnValue($folder));
+
+ $this->folderMapper->expects($this->once())
+ ->method('update')
+ ->with($this->equalTo($folder));
+
+ $this->folderBl->rename(3, 'bogus', '');
+
+ $this->assertEquals('bogus', $folder->getName());
+ }
+
+}
diff --git a/tests/db/FeedMapperTest.php b/tests/db/FeedMapperTest.php
index 8a0c2b733..a070e5dd9 100644
--- a/tests/db/FeedMapperTest.php
+++ b/tests/db/FeedMapperTest.php
@@ -120,7 +120,7 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility {
array('id' => $this->feeds[0]->getId()),
array('id' => $this->feeds[1]->getId())
);
- $sql = 'SELECT `feeds`.*, COUNT(`items`.`id`) AS unread_count ' .
+ $sql = 'SELECT `feeds`.*, COUNT(`items`.`id`) AS `unread_count` ' .
'FROM `*dbprefix*news_feeds` `feeds` ' .
'LEFT OUTER JOIN `*dbprefix*news_items` `items` ' .
'ON `feeds`.`id` = `items`.`feed_id` ' .
diff --git a/opmlexporter.php b/utility/opmlexporter.php
index d9d404ff1..d9d404ff1 100644
--- a/opmlexporter.php
+++ b/utility/opmlexporter.php
diff --git a/lib/utils.php b/utility/utils.php
index 560114ca7..560114ca7 100644
--- a/lib/utils.php
+++ b/utility/utils.php