diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-13 23:13:52 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-13 23:13:52 +0200 |
commit | 7faa40dc59738fc4b5bb9dd2121e433e2301c36b (patch) | |
tree | 2eac772fb6e39eebbf4349760f5757c6b2547ecf /tests/unit/controller/EntityApiSerializerTest.php | |
parent | f333f6b38f985c40247f7c82dd462f3016611dfe (diff) |
fix some tests
Diffstat (limited to 'tests/unit/controller/EntityApiSerializerTest.php')
-rw-r--r-- | tests/unit/controller/EntityApiSerializerTest.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/unit/controller/EntityApiSerializerTest.php b/tests/unit/controller/EntityApiSerializerTest.php new file mode 100644 index 000000000..8153f40d6 --- /dev/null +++ b/tests/unit/controller/EntityApiSerializerTest.php @@ -0,0 +1,50 @@ +<?php +/** + * ownCloud - 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\Controller; + +require_once(__DIR__ . "/../../classloader.php"); + +use \OCA\News\Db\Item; + + +class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase { + + + public function testSerializeSingle() { + $item = new Item(); + $item->setUnread(); + + $serializer = new EntityApiSerializer('items'); + $result = $serializer->serialize($item); + + $this->assertTrue($result['items'][0]['unread']); + } + + + public function testSerializeMultiple() { + $item = new Item(); + $item->setUnread(); + + $item2 = new Item(); + $item2->setRead(); + + $serializer = new EntityApiSerializer('items'); + $result = $serializer->serialize(array($item, $item2)); + + $this->assertTrue($result['items'][0]['unread']); + $this->assertFalse($result['items'][1]['unread']); + } + + +}
\ No newline at end of file |