summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 09:27:23 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-09 09:27:23 +0200
commit6fa7d6e4db1a953aa87b47b74128465c7957ebf9 (patch)
treefa5d2dcf45388d7968f03e96ab3ec6fa4ea6a112
parent8462bed7820cecc23a0e0d64aa50db7be92272d9 (diff)
more code coverage
-rw-r--r--tests/unit/controller/EntityApiSerializerTest.php19
-rw-r--r--tests/unit/utility/ConfigTest.php22
2 files changed, 40 insertions, 1 deletions
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