From 8462bed7820cecc23a0e0d64aa50db7be92272d9 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 9 Oct 2014 09:08:19 +0200 Subject: cleanup test method in appconfig class, add test for item serialization --- tests/unit/db/ItemTest.php | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/db/ItemTest.php b/tests/unit/db/ItemTest.php index 23deb4c14..4c9569ed4 100644 --- a/tests/unit/db/ItemTest.php +++ b/tests/unit/db/ItemTest.php @@ -89,6 +89,42 @@ class ItemTest extends \PHPUnit_Framework_TestCase { } + public function testJSONSerialize() { + $item = new Item(); + $item->setId(3); + $item->setGuid('guid'); + $item->setGuidHash('hash'); + $item->setUrl('https://google'); + $item->setTitle('title'); + $item->setAuthor('author'); + $item->setPubDate(123); + $item->setBody('body'); + $item->setEnclosureMime('audio/ogg'); + $item->setEnclosureLink('enclink'); + $item->setFeedId(1); + $item->setStatus(0); + $item->setUnread(); + $item->setStarred(); + $item->setLastModified(321); + + $this->assertEquals([ + 'id' => 3, + 'guid' => 'guid', + 'guidHash' => 'hash', + 'url' => 'https://google', + 'title' => 'title', + 'author' => 'author', + 'pubDate' => 123, + 'body' => 'body', + 'enclosureMime' => 'audio/ogg', + 'enclosureLink' => 'enclink', + 'feedId' => 1, + 'unread' => true, + 'starred' => true, + 'lastModified' => 321 + ], $item->jsonSerialize()); + } + public function testToExport() { $item = new Item(); $item->setId(3); @@ -154,7 +190,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { ]; $compareWith = Item::fromImport($import); - + $this->assertEquals($item, $compareWith); } @@ -199,7 +235,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { public function testMakeLinksInBodyOpenNewTab() { $item = new Item(); $item->setBody("ha"); - $this->assertEquals("ha", + $this->assertEquals("ha", $item->getBody()); } -- cgit v1.2.3