From 5b90e1f4a0057aa78fd7d8d4d748b01676ec9073 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 1 Mar 2015 09:18:06 -0500 Subject: Introduce user queries objects There is now an object to manipulate user queries. It allows to move logic to handle those from the view and the controller in the model. Thus making the view and the controller easier to read. I introduced a new interface to start using dependency injection. There is still some rough edges but we are moving in the right direction. The new object is fully tested but it still need some improvements, for instance, it is still tied to the search object. There might be a better way to do that. --- app/Exceptions/DAOException.php | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/Exceptions/DAOException.php (limited to 'app/Exceptions/DAOException.php') diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php new file mode 100644 index 000000000..6bd8f4ff0 --- /dev/null +++ b/app/Exceptions/DAOException.php @@ -0,0 +1,5 @@ + Date: Thu, 5 Mar 2015 06:45:00 -0500 Subject: Fix DAO exception Change the name and messages --- app/Exceptions/DAOException.php | 2 +- app/Models/UserQuery.php | 8 ++++---- tests/app/Models/UserQueryTest.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/Exceptions/DAOException.php') diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php index 6bd8f4ff0..e48e521ab 100644 --- a/app/Exceptions/DAOException.php +++ b/app/Exceptions/DAOException.php @@ -1,5 +1,5 @@ category_dao)) { - throw new FreshRSS_DAOException('Category DAO is not loaded i UserQuery'); + throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery'); } $category = $this->category_dao->searchById($id); if ($category) { @@ -123,11 +123,11 @@ class FreshRSS_UserQuery { * Parse the query string when it is a "feed" query * * @param integer $id - * @throws FreshRSS_DAOException + * @throws FreshRSS_DAO_Exception */ private function parseFeed($id) { if (is_null($this->feed_dao)) { - throw new FreshRSS_DAOException('Feed DAO is not loaded i UserQuery'); + throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery'); } $feed = $this->feed_dao->searchById($id); if ($feed) { diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php index 2234be6e1..a0928d5ae 100644 --- a/tests/app/Models/UserQueryTest.php +++ b/tests/app/Models/UserQueryTest.php @@ -20,7 +20,7 @@ class UserQueryTest extends \PHPUnit_Framework_TestCase { } /** - * @expectedException Exceptions/FreshRSS_DAOException + * @expectedException Exceptions/FreshRSS_DAO_Exception * @expectedExceptionMessage Category DAO is not loaded in UserQuery */ public function test__construct_whenCategoryQueryAndNoDao_throwsException() { @@ -48,7 +48,7 @@ class UserQueryTest extends \PHPUnit_Framework_TestCase { } /** - * @expectedException Exceptions/FreshRSS_DAOException + * @expectedException Exceptions/FreshRSS_DAO_Exception * @expectedExceptionMessage Feed DAO is not loaded in UserQuery */ public function test__construct_whenFeedQueryAndNoDao_throwsException() { -- cgit v1.2.3 From 214a5cc9a4c2b821961bc21f22b4b08e34b5be68 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 3 Jun 2015 20:21:32 +0200 Subject: PHP 5.2 compatiblity Namespaces are not needed so far. https://github.com/FreshRSS/FreshRSS/commit/aacd1ffd4052b04c724c2783b3ee2845ca4ada35#commitcomment-11503581 --- app/Exceptions/ContextException.php | 2 +- app/Exceptions/DAOException.php | 2 +- app/Exceptions/EntriesGetterException.php | 2 +- app/Exceptions/FeedException.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/Exceptions/DAOException.php') diff --git a/app/Exceptions/ContextException.php b/app/Exceptions/ContextException.php index 8f05eccd6..00934cbfd 100644 --- a/app/Exceptions/ContextException.php +++ b/app/Exceptions/ContextException.php @@ -3,6 +3,6 @@ /** * An exception raised when a context is invalid */ -class FreshRSS_Context_Exception extends \Exception { +class FreshRSS_Context_Exception extends Exception { } diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php index e48e521ab..14bee3403 100644 --- a/app/Exceptions/DAOException.php +++ b/app/Exceptions/DAOException.php @@ -1,5 +1,5 @@