summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Db
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-08-29 23:39:35 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-09-27 15:35:31 +0200
commitd00d1ab2a28f428223e52b17052c072c64784016 (patch)
treec019f85fb7ac67147dd43ca64b4ac3cda99832f7 /tests/Unit/Db
parent5687baca75d47dbdffd3de74e865ad2f71ef0cb7 (diff)
Create V2 mapper, Service and management commands
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Unit/Db')
-rw-r--r--tests/Unit/Db/FeedTest.php25
-rw-r--r--tests/Unit/Db/FolderMapperTest.php6
-rw-r--r--tests/Unit/Db/FolderTest.php9
-rw-r--r--tests/Unit/Db/MapperFactoryTest.php4
4 files changed, 24 insertions, 20 deletions
diff --git a/tests/Unit/Db/FeedTest.php b/tests/Unit/Db/FeedTest.php
index 47595633d..1812b7164 100644
--- a/tests/Unit/Db/FeedTest.php
+++ b/tests/Unit/Db/FeedTest.php
@@ -51,18 +51,19 @@ class FeedTest extends TestCase
$this->assertEquals(
[
- 'id' => 3,
- 'url' => 'http://google.com/some/weird/path',
- 'title' => 'title',
- 'faviconLink' => 'favicon',
- 'added' => 123,
- 'folderId' => 1,
- 'unreadCount' => 321,
- 'ordering' => 2,
- 'pinned' => true,
- 'link' => 'https://www.google.com/some/weird/path',
- 'updateErrorCount' => 2,
- 'lastUpdateError' => 'hi'
+ 'id' => 3,
+ 'url' => 'http://google.com/some/weird/path',
+ 'title' => 'title',
+ 'faviconLink' => 'favicon',
+ 'added' => 123,
+ 'folderId' => 1,
+ 'unreadCount' => 321,
+ 'ordering' => 2,
+ 'pinned' => true,
+ 'link' => 'https://www.google.com/some/weird/path',
+ 'updateErrorCount' => 2,
+ 'lastUpdateError' => 'hi',
+ 'items' => [],
], $feed->toAPI()
);
}
diff --git a/tests/Unit/Db/FolderMapperTest.php b/tests/Unit/Db/FolderMapperTest.php
index f8544da65..deb235ff7 100644
--- a/tests/Unit/Db/FolderMapperTest.php
+++ b/tests/Unit/Db/FolderMapperTest.php
@@ -62,7 +62,7 @@ class FolderMapperTest extends MapperTestUtility
$this->setMapperResult($sql, [$id, $userId], $rows);
- $result = $this->folderMapper->find($id, $userId);
+ $result = $this->folderMapper->find($userId, $id);
$this->assertEquals($this->folders[0], $result);
}
@@ -79,7 +79,7 @@ class FolderMapperTest extends MapperTestUtility
$this->setMapperResult($sql, [$id, $userId]);
$this->expectException(DoesNotExistException::class);
- $this->folderMapper->find($id, $userId);
+ $this->folderMapper->find($userId, $id);
}
@@ -95,7 +95,7 @@ class FolderMapperTest extends MapperTestUtility
$this->setMapperResult($sql, [$id, $userId], $rows);
$this->expectException(MultipleObjectsReturnedException::class);
- $this->folderMapper->find($id, $userId);
+ $this->folderMapper->find($userId, $id);
}
diff --git a/tests/Unit/Db/FolderTest.php b/tests/Unit/Db/FolderTest.php
index a3445ea2e..7fdb1ae07 100644
--- a/tests/Unit/Db/FolderTest.php
+++ b/tests/Unit/Db/FolderTest.php
@@ -20,7 +20,7 @@ class FolderTest extends TestCase
{
- public function testToAPI()
+ public function testToAPI()
{
$folder = new Folder();
$folder->setId(3);
@@ -28,14 +28,15 @@ class FolderTest extends TestCase
$this->assertEquals(
[
- 'id' => 3,
- 'name' => 'name'
+ 'id' => 3,
+ 'name' => 'name',
+ 'feeds' => [],
], $folder->toAPI()
);
}
- public function testSerialize()
+ public function testSerialize()
{
$folder = new Folder();
$folder->setId(3);
diff --git a/tests/Unit/Db/MapperFactoryTest.php b/tests/Unit/Db/MapperFactoryTest.php
index 97680e20b..1c4e2f4b6 100644
--- a/tests/Unit/Db/MapperFactoryTest.php
+++ b/tests/Unit/Db/MapperFactoryTest.php
@@ -26,8 +26,10 @@ use OCA\News\Db\Mysql\ItemMapper as MysqlMapper;
class MapperFactoryTest extends TestCase
{
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IDBConnection
+ */
private $db;
- private $settings;
public function setUp(): void
{