summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-11-06 14:45:14 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2014-11-06 14:45:14 +0100
commitdcf96e729991764e5dc5d5d9cc384540427dfdc4 (patch)
treece4778585cdcd6f96ca5723e599ac718565a9d23
parent5395685b0556921bc87ccc7e4076caabd16f0bcf (diff)
more integration tests
-rw-r--r--appinfo/database.xml2
-rw-r--r--appinfo/info.xml2
-rw-r--r--tests/integration/bootstrap.php8
-rw-r--r--tests/integration/db/ItemMapperTest.php36
-rw-r--r--tests/integration/fixtures/feeds.json4
-rw-r--r--tests/integration/fixtures/items.json117
6 files changed, 158 insertions, 11 deletions
diff --git a/appinfo/database.xml b/appinfo/database.xml
index 5643ea5b6..f7a95746e 100644
--- a/appinfo/database.xml
+++ b/appinfo/database.xml
@@ -252,7 +252,7 @@
<name>status</name>
<type>integer</type>
<length>8</length>
- <notnull>true</notnull>
+ <notnull>false</notnull>
</field>
<field>
<name>last_modified</name>
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 1234286d1..d3ea13c0c 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -4,7 +4,7 @@
<name>News</name>
<description>An RSS/Atom feed reader. Requires ownCloud backgroundjobs or an updater script to be enabled to update your feeds. See the README.md in the apps top directory</description>
<licence>AGPL</licence>
- <version>3.999.3</version>
+ <version>3.999.4</version>
<require>7.0.3</require>
<author>Bernhard Posselt, Alessandro Cosentino, Jan-Christoph Borchardt</author>
</info>
diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php
index 8096cbacd..815913e3a 100644
--- a/tests/integration/bootstrap.php
+++ b/tests/integration/bootstrap.php
@@ -78,7 +78,7 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
if (array_key_exists($feed['title'], $items)) {
foreach ($items[$feed['title']] as $item) {
$item['feedId'] = $newFeed->getId();
- $this->items[$item->getTitle()] =
+ $this->items[$item['title']] =
$this->createItem($item);
}
}
@@ -95,7 +95,7 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
if (array_key_exists($feed['title'], $items)) {
foreach ($items[$feed['title']] as $item) {
$item['feedId'] = $newFeed->getId();
- $this->items[$item->getTitle()] =
+ $this->items[$item['title']] =
$this->createItem($item);
}
}
@@ -147,13 +147,13 @@ class NewsIntegrationTest extends \PHPUnit_Framework_TestCase {
$newItem->setLastModified($item['lastModified']);
$newItem->setEnclosureMime($item['enclosureMime']);
$newItem->setEnclosureLink($item['enclosureLink']);
- return $this->itemMapper->insert($item);
+ return $this->itemMapper->insert($newItem);
}
protected function whenOlderThan($olderThan, $callback) {
$ocVersion = $this->ownCloudVersion;
- if (version_compare(implode('.', $ocVersion), $olderThan, '<=')) {
+ if (version_compare(implode('.', $ocVersion), $olderThan, '<')) {
$callback();
}
}
diff --git a/tests/integration/db/ItemMapperTest.php b/tests/integration/db/ItemMapperTest.php
index dcc27ab98..c86112d46 100644
--- a/tests/integration/db/ItemMapperTest.php
+++ b/tests/integration/db/ItemMapperTest.php
@@ -28,4 +28,40 @@ class ItemMapperTest extends NewsIntegrationTest {
$this->assertEquals('Döner', $fetched->getBody());
}
+
+ /**
+ * @expectedException OCP\AppFramework\Db\DoesNotExistException
+ */
+ public function testFindNotFoundWhenDeletedFeed() {
+ $id = $this->items['not found feed']->getId();
+ $this->itemMapper->find($id, $this->userId);
+ }
+
+
+ /**
+ * @expectedException OCP\AppFramework\Db\DoesNotExistException
+ */
+ public function testFindNotFoundWhenDeletedFolder() {
+ $id = $this->items['not found folder']->getId();
+ $this->itemMapper->find($id, $this->userId);
+ }
+
+
+ public function testDeleteOlderThanThreshold() {
+ $this->itemMapper->deleteReadOlderThanThreshold(1);
+ $item1 = $this->items['del1'];
+ $item2 = $this->items['del2'];
+ $item3 = $this->items['del3'];
+ $item4 = $this->items['del4'];
+
+ $this->itemMapper->find($item3->getId(), $this->userId);
+ $this->itemMapper->find($item4->getId(), $this->userId);
+
+ //$this->setExpectedException(
+ // 'OCP\AppFramework\Db\DoesNotExistException');
+ $this->itemMapper->find($item1->getId(), $this->userId);
+ $this->itemMapper->find($item2->getId(), $this->userId);
+ }
+
+
} \ No newline at end of file
diff --git a/tests/integration/fixtures/feeds.json b/tests/integration/fixtures/feeds.json
index c3848bd78..b1696a9eb 100644
--- a/tests/integration/fixtures/feeds.json
+++ b/tests/integration/fixtures/feeds.json
@@ -10,7 +10,7 @@
"added": 3000,
"link": "http://feed.com/rss",
"preventUpdate": false,
- "articlesPerUpdate": 40,
+ "articlesPerUpdate": 1,
"lastModified": "",
"etag": ""
},
@@ -44,7 +44,7 @@
"etag": ""
},
{
- "title": "fifth feed",
+ "title": "sixth feed",
"url": "http://gremlins.de",
"deletedAt": 999999999,
"location": "http://feed.com/rss",
diff --git a/tests/integration/fixtures/items.json b/tests/integration/fixtures/items.json
index 56c70edbe..780796afe 100644
--- a/tests/integration/fixtures/items.json
+++ b/tests/integration/fixtures/items.json
@@ -1,5 +1,116 @@
{
- "first feed": [
-
- ]
+ "first feed": [
+ {
+ "status": 2,
+ "body": "this is a body",
+ "title": "a title1",
+ "author": "my author",
+ "guid": "abc",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 0,
+ "body": "this is a body",
+ "title": "del1",
+ "author": "my author",
+ "guid": "del1",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 0,
+ "body": "this is a body",
+ "title": "del2",
+ "author": "my author",
+ "guid": "del2",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 0,
+ "body": "this is a body",
+ "title": "del3",
+ "author": "my author",
+ "guid": "del3",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 0,
+ "body": "this is a body",
+ "title": "del4",
+ "author": "my author",
+ "guid": "del4",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 4,
+ "body": "this is a body",
+ "title": "a title2",
+ "author": "my author",
+ "guid": "def",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ },
+ {
+ "status": 6,
+ "body": "this is a body",
+ "title": "a title3",
+ "author": "my author",
+ "guid": "gih",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ }
+ ],
+ "fifth feed": [
+ {
+ "status": 2,
+ "body": "this is a body",
+ "title": "not found folder",
+ "author": "my author",
+ "guid": "not found",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ }
+ ],
+ "sixth feed": [
+ {
+ "status": 2,
+ "body": "this is a body",
+ "title": "not found feed",
+ "author": "my author",
+ "guid": "not found",
+ "url": "http://google.de",
+ "pubDate": 2323,
+ "lastModified": 113,
+ "enclosureMime": "video/mpeg",
+ "enclosureLink": "http://google.de/web.webm"
+ }
+ ]
} \ No newline at end of file