summaryrefslogtreecommitdiffstats
path: root/tests/unit/db
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 01:04:57 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 01:04:57 +0200
commit2bfa9f22b7d97dcdbda5992ad603d9d10482b49f (patch)
tree6d23098988a6a7ab0b99b4baf1b6ad13b9a7be25 /tests/unit/db
parent7faa40dc59738fc4b5bb9dd2121e433e2301c36b (diff)
fix unittests
Diffstat (limited to 'tests/unit/db')
-rw-r--r--tests/unit/db/FeedMapperTest.php12
-rw-r--r--tests/unit/db/FolderMapperTest.php8
-rw-r--r--tests/unit/db/ItemMapperTest.php9
-rw-r--r--tests/unit/db/ItemTest.php20
-rw-r--r--tests/unit/db/MapperFactoryTest.php2
-rw-r--r--tests/unit/db/postgres/ItemMapperTest.php7
6 files changed, 31 insertions, 27 deletions
diff --git a/tests/unit/db/FeedMapperTest.php b/tests/unit/db/FeedMapperTest.php
index 5c2921063..607255fde 100644
--- a/tests/unit/db/FeedMapperTest.php
+++ b/tests/unit/db/FeedMapperTest.php
@@ -16,13 +16,13 @@ namespace OCA\News\Db;
require_once(__DIR__ . "/../../classloader.php");
-class FeedMapperTest extends \OCA\News\Utility\MapperTestUtility {
+class FeedMapperTest extends \OCP\AppFramework\Db\MapperTestUtility {
private $mapper;
private $feeds;
protected function setUp(){
- $this->beforeEach();
+ parent::setUp();
$this->mapper = new FeedMapper($this->db);
@@ -83,7 +83,7 @@ class FeedMapperTest extends \OCA\News\Utility\MapperTestUtility {
$params = array($id, $userId);
$this->setMapperResult($sql, $params);
- $this->setExpectedException('\OCA\News\Db\DoesNotExistException');
+ $this->setExpectedException('\OCP\AppFramework\Db\DoesNotExistException');
$this->mapper->find($id, $userId);
}
@@ -110,7 +110,7 @@ class FeedMapperTest extends \OCA\News\Utility\MapperTestUtility {
$params = array($id, $userId);
$this->setMapperResult($sql, $params, $rows);
- $this->setExpectedException('\OCA\News\Db\MultipleObjectsReturnedException');
+ $this->setExpectedException('\OCP\AppFramework\Db\MultipleObjectsReturnedException');
$this->mapper->find($id, $userId);
}
@@ -225,7 +225,7 @@ class FeedMapperTest extends \OCA\News\Utility\MapperTestUtility {
$this->setMapperResult($sql,
array($urlHash, $this->user));
- $this->setExpectedException('\OCA\News\Db\DoesNotExistException');
+ $this->setExpectedException('\OCP\AppFramework\Db\DoesNotExistException');
$this->mapper->findByUrlHash($urlHash, $this->user);
}
@@ -251,7 +251,7 @@ class FeedMapperTest extends \OCA\News\Utility\MapperTestUtility {
$this->setMapperResult($sql,
array($urlHash, $this->user), $rows);
- $this->setExpectedException('\OCA\News\Db\MultipleObjectsReturnedException');
+ $this->setExpectedException('\OCP\AppFramework\Db\MultipleObjectsReturnedException');
$this->mapper->findByUrlHash($urlHash, $this->user);
}
diff --git a/tests/unit/db/FolderMapperTest.php b/tests/unit/db/FolderMapperTest.php
index c979f8ce0..359d63894 100644
--- a/tests/unit/db/FolderMapperTest.php
+++ b/tests/unit/db/FolderMapperTest.php
@@ -16,14 +16,14 @@ namespace OCA\News\Db;
require_once(__DIR__ . "/../../classloader.php");
-class FolderMapperTest extends \OCA\News\Utility\MapperTestUtility {
+class FolderMapperTest extends \OCP\AppFramework\Db\MapperTestUtility {
private $folderMapper;
private $folders;
private $user;
protected function setUp(){
- $this->beforeEach();
+ parent::setUp();
$this->folderMapper = new FolderMapper($this->db);
@@ -66,7 +66,7 @@ class FolderMapperTest extends \OCA\News\Utility\MapperTestUtility {
$this->setMapperResult($sql, array($id, $userId));
- $this->setExpectedException('\OCA\News\Db\DoesNotExistException');
+ $this->setExpectedException('\OCP\AppFramework\Db\DoesNotExistException');
$this->folderMapper->find($id, $userId);
}
@@ -84,7 +84,7 @@ class FolderMapperTest extends \OCA\News\Utility\MapperTestUtility {
$this->setMapperResult($sql, array($id, $userId), $rows);
- $this->setExpectedException('\OCA\News\Db\MultipleObjectsReturnedException');
+ $this->setExpectedException('\OCP\AppFramework\Db\MultipleObjectsReturnedException');
$this->folderMapper->find($id, $userId);
}
diff --git a/tests/unit/db/ItemMapperTest.php b/tests/unit/db/ItemMapperTest.php
index d9d6bf02c..b0a64a16d 100644
--- a/tests/unit/db/ItemMapperTest.php
+++ b/tests/unit/db/ItemMapperTest.php
@@ -16,7 +16,7 @@ namespace OCA\News\Db;
require_once(__DIR__ . "/../../classloader.php");
-class ItemMapperTest extends \OCA\News\Utility\MapperTestUtility {
+class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility {
private $mapper;
private $items;
@@ -28,9 +28,8 @@ class ItemMapperTest extends \OCA\News\Utility\MapperTestUtility {
private $status;
- public function setUp()
- {
- $this->beforeEach();
+ public function setUp() {
+ parent::setUp();
$this->mapper = new ItemMapper($this->db);
@@ -387,7 +386,7 @@ class ItemMapperTest extends \OCA\News\Utility\MapperTestUtility {
$rows = array();
$this->setMapperResult($sql, $params, $rows);
- $this->setExpectedException('\OCA\News\Db\DoesNotExistException');
+ $this->setExpectedException('\OCP\AppFramework\Db\DoesNotExistException');
$this->mapper->getNewestItemId($this->user);
}
diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php
index b979450aa..2da81cda0 100644
--- a/tests/unit/db/ItemTest.php
+++ b/tests/unit/db/ItemTest.php
@@ -141,18 +141,24 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setBody('body');
$item->setEnclosureMime('audio/ogg');
$item->setEnclosureLink('enclink');
- $item->setFeedId(1);
$item->setUnread();
$item->setStarred();
- $feed = new Feed();
- $feed->setLink('http://test');
- $feeds = array(
- "feed1" => $feed
+ $import = array(
+ 'guid' => $item->getGuid(),
+ 'url' => $item->getUrl(),
+ 'title' => $item->getTitle(),
+ 'author' => $item->getAuthor(),
+ 'pubDate' => $item->getPubDate(),
+ 'body' => $item->getBody(),
+ 'enclosureMime' => $item->getEnclosureMime(),
+ 'enclosureLink' => $item->getEnclosureLink(),
+ 'unread' => $item->isUnread(),
+ 'starred' => $item->isStarred(),
);
- $compareWith = Item::fromImport($item->toExport($feeds));
- $item->setFeedId(null);
+ $compareWith = Item::fromImport($import);
+
$this->assertEquals($item, $compareWith);
}
diff --git a/tests/unit/db/MapperFactoryTest.php b/tests/unit/db/MapperFactoryTest.php
index 2f0e86be4..c1acd0dbc 100644
--- a/tests/unit/db/MapperFactoryTest.php
+++ b/tests/unit/db/MapperFactoryTest.php
@@ -23,7 +23,7 @@ class MapperFactoryTest extends \PHPUnit_Framework_TestCase {
private $settings;
public function setUp() {
- $this->db = $this->getMockBuilder('\OCA\News\Core\Db')
+ $this->db = $this->getMockBuilder('\OCP\IDb')
->disableOriginalConstructor()
->getMock();
}
diff --git a/tests/unit/db/postgres/ItemMapperTest.php b/tests/unit/db/postgres/ItemMapperTest.php
index 1bc298566..24a0e8e25 100644
--- a/tests/unit/db/postgres/ItemMapperTest.php
+++ b/tests/unit/db/postgres/ItemMapperTest.php
@@ -20,7 +20,7 @@ use \OCA\News\Db\StatusFlag;
require_once(__DIR__ . "/../../../classloader.php");
-class ItemMapperTest extends \OCA\News\Utility\MapperTestUtility {
+class ItemMapperTest extends \OCP\AppFramework\Db\MapperTestUtility {
private $mapper;
private $items;
@@ -32,9 +32,8 @@ class ItemMapperTest extends \OCA\News\Utility\MapperTestUtility {
private $status;
- public function setUp()
- {
- $this->beforeEach();
+ public function setUp() {
+ parent::setUp();
$this->mapper = new ItemMapper($this->db);