From 6fa7d6e4db1a953aa87b47b74128465c7957ebf9 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 9 Oct 2014 09:27:23 +0200 Subject: more code coverage --- tests/unit/controller/EntityApiSerializerTest.php | 19 ++++++++++++++++++- tests/unit/utility/ConfigTest.php | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/unit/controller/EntityApiSerializerTest.php b/tests/unit/controller/EntityApiSerializerTest.php index 9e77421ce..80752889d 100644 --- a/tests/unit/controller/EntityApiSerializerTest.php +++ b/tests/unit/controller/EntityApiSerializerTest.php @@ -15,9 +15,14 @@ namespace OCA\News\Controller; use \OCP\AppFramework\Http\Response; +use \OCP\AppFramework\Db\Entity; use \OCA\News\Db\Item; +class TestEntity extends Entity { + +} + class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase { @@ -81,7 +86,7 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase { } - public function noEntityNoChange() { + public function testNoEntityNoChange() { $serializer = new EntityApiSerializer('items'); $in = [ @@ -96,4 +101,16 @@ class EntityApiSerializerTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(1, $result['test']); } + + public function testEntitiesNoChange() { + $serializer = new EntityApiSerializer('items'); + + $in = [ + 'items' => [new TestEntity()] + ]; + + $result = $serializer->serialize($in); + + $this->assertEquals($in, $result); + } } \ No newline at end of file diff --git a/tests/unit/utility/ConfigTest.php b/tests/unit/utility/ConfigTest.php index ad26035f5..613944eb2 100644 --- a/tests/unit/utility/ConfigTest.php +++ b/tests/unit/utility/ConfigTest.php @@ -182,4 +182,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->assertEquals('this is a test:se', $this->config->getProxyAuth()); } + + + public function testMinimumAutoPurgeInterval() { + $this->config->setAutoPurgeMinimumInterval(30); + $interval = $this->config->getAutoPurgeMinimumInterval(); + + $this->assertSame(60, $interval); + } + + public function testCacheDuration() { + $this->config->setSimplePieCacheDuration(21); + $duration = $this->config->getSimplePieCacheDuration(); + + $this->assertSame(21, $duration); + } + + public function testFeedFetcherTimeout() { + $this->config->setFeedFetcherTimeout(2); + $timout = $this->config->getFeedFetcherTimeout(); + + $this->assertSame(2, $timout); + } } \ No newline at end of file -- cgit v1.2.3