diff options
author | Daniel Opitz <danopz@users.noreply.github.com> | 2017-08-14 10:34:53 +0200 |
---|---|---|
committer | Bernhard Posselt <BernhardPosselt@users.noreply.github.com> | 2017-08-14 10:34:53 +0200 |
commit | a97dd58e3b499b60ac8b37786d402d7f2e371a88 (patch) | |
tree | 98bb8a6c750fb33fbef38d22407fa29fbf6c7b1e /tests/Unit/Service/StatusFlagTest.php | |
parent | 7d8a85c82c4c13a71b70ddb4ecb8c40ede4c9b70 (diff) |
Split binary to booleans (#203)
* replaced old status with 2 flags for unread and starred
* add fields to db, replace int(1,0) with booleans in sql queries, removed StatusFlags class + refactor code relying to it
* add repair step for migration
* again use integer(1,0) instead of bool in sql queries, because of sqlite doesn't support true/false
* add/fix unit tests for new boolean status
* set unread/starred flags as statements in sql
* fixed mysql unknown column items.unread, fixed marking of read items on repair step
* remove unnecessary bool casts
* add empty checks to Items::is* methods
* update migration to use native sql instead of the querybuilder
* don't cast the flags manually, let the api do the work
Diffstat (limited to 'tests/Unit/Service/StatusFlagTest.php')
-rw-r--r-- | tests/Unit/Service/StatusFlagTest.php | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/tests/Unit/Service/StatusFlagTest.php b/tests/Unit/Service/StatusFlagTest.php deleted file mode 100644 index 5d672fc53..000000000 --- a/tests/Unit/Service/StatusFlagTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Nextcloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Alessandro Cosentino <cosenal@gmail.com> - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Alessandro Cosentino 2012 - * @copyright Bernhard Posselt 2012, 2014 - */ - -namespace OCA\News\Db; - - -class StatusFlagTest extends \PHPUnit_Framework_TestCase { - - private $statusFlag; - - protected function setUp(){ - $this->statusFlag = new StatusFlag(); - } - - - public function testTypeToStatusUnreadStarred(){ - $expected = StatusFlag::STARRED; - $status = $this->statusFlag->typeToStatus(FeedType::STARRED, false); - - $this->assertEquals($expected, $status); - } - - - public function testTypeToStatusUnread(){ - $expected = StatusFlag::UNREAD; - $status = $this->statusFlag->typeToStatus(FeedType::FEED, false); - - $this->assertEquals($expected, $status); - } - - - public function testTypeToStatusReadStarred(){ - $expected = StatusFlag::STARRED; - $status = $this->statusFlag->typeToStatus(FeedType::STARRED, true); - - $this->assertEquals($expected, $status); - } - - - public function testTypeToStatusRead(){ - $expected = (~StatusFlag::UNREAD) & 0; - $status = $this->statusFlag->typeToStatus(FeedType::FEED, true); - - $this->assertEquals($expected, $status); - } - -}
\ No newline at end of file |