summaryrefslogtreecommitdiffstats
path: root/tests/integration/fixtures
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-11-29 22:14:56 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2016-01-17 18:18:39 +0100
commit646b5296843de0815c47fe809178613a5b4fafaa (patch)
treea720bc5b8d455f0e7753deb79b705d8ae6528927 /tests/integration/fixtures
parentd0155e9d66665a7195194a988e16ff16623e28f0 (diff)
update fixtures to simpler array
Diffstat (limited to 'tests/integration/fixtures')
-rw-r--r--tests/integration/fixtures/FeedFixture.php1
-rw-r--r--tests/integration/fixtures/Fixture.php2
-rw-r--r--tests/integration/fixtures/FolderFixture.php35
-rw-r--r--tests/integration/fixtures/ItemFixture.php43
-rw-r--r--tests/integration/fixtures/data/default.php74
-rw-r--r--tests/integration/fixtures/feeds.json86
-rw-r--r--tests/integration/fixtures/folders.json17
-rw-r--r--tests/integration/fixtures/items.json144
8 files changed, 154 insertions, 248 deletions
diff --git a/tests/integration/fixtures/FeedFixture.php b/tests/integration/fixtures/FeedFixture.php
index 286373c76..7b2d68c80 100644
--- a/tests/integration/fixtures/FeedFixture.php
+++ b/tests/integration/fixtures/FeedFixture.php
@@ -44,6 +44,7 @@ class FeedFixture extends Feed {
'updateErrorCount' => 0,
'lastUpdateError' => 'lastUpdateError',
], $defaults);
+ unset($defaults['items']);
$this->fillDefaults($defaults);
}
diff --git a/tests/integration/fixtures/Fixture.php b/tests/integration/fixtures/Fixture.php
index 52015ebc2..2e546c4a5 100644
--- a/tests/integration/fixtures/Fixture.php
+++ b/tests/integration/fixtures/Fixture.php
@@ -13,7 +13,7 @@
namespace OCA\News\Tests\Integration\Fixtures;
-trait Fixture {
+trait Entity {
public function fillDefaults(array $defaults=[]) {
foreach ($defaults as $key => $value) {
diff --git a/tests/integration/fixtures/FolderFixture.php b/tests/integration/fixtures/FolderFixture.php
new file mode 100644
index 000000000..872ee33b8
--- /dev/null
+++ b/tests/integration/fixtures/FolderFixture.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2015
+ */
+
+
+namespace OCA\News\Tests\Integration\Fixtures;
+
+
+use OCA\News\Db\Folder;
+
+class FolderFixture extends Folder {
+ use Fixture;
+
+ public function __construct(array $defaults=[]) {
+ parent::__construct();
+ $defaults = array_combine([
+ 'parentId' => 0,
+ 'name' => 'folder',
+ 'userId' => 'test',
+ 'opened' => true,
+ 'deletedAt' => 0,
+
+ ], $defaults);
+ unset($defaults['feeds']);
+ $this->fillDefaults($defaults);
+ }
+
+} \ No newline at end of file
diff --git a/tests/integration/fixtures/ItemFixture.php b/tests/integration/fixtures/ItemFixture.php
new file mode 100644
index 000000000..412f1c990
--- /dev/null
+++ b/tests/integration/fixtures/ItemFixture.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2015
+ */
+
+
+namespace OCA\News\Tests\Integration\Fixtures;
+
+
+use OCA\News\Db\Item;
+
+class ItemFixture extends Item {
+ use Fixture;
+
+ public function __construct(array $defaults=[]) {
+ parent::__construct();
+ $defaults = array_combine([
+ 'guid' => 'guid',
+ 'url' => 'http://google.de',
+ 'title' => 'title',
+ 'author' => 'author',
+ 'pubDate' => 2323,
+ 'body' => 'this is a body',
+ 'enclosureMime' => 'video/mpeg',
+ 'enclosureLink' => 'http://google.de/web.webm',
+ 'feedId' => 0,
+ 'status' => 2,
+ 'lastModified' => 113,
+ 'rtl' => false,
+ ], $defaults);
+ $this->fillDefaults($defaults);
+ $this->generateSearchIndex();
+ $this->setGuid($this->getTitle());
+ $this->setGuidHash($this->getGuid());
+ }
+
+} \ No newline at end of file
diff --git a/tests/integration/fixtures/data/default.php b/tests/integration/fixtures/data/default.php
new file mode 100644
index 000000000..b314d9496
--- /dev/null
+++ b/tests/integration/fixtures/data/default.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2015
+ */
+
+return [
+ 'folders' => [
+ [
+ 'name' => 'first folder',
+ 'feeds' => [
+ [
+ 'title' => 'first feed',
+ 'url' => 'http://google.de',
+ 'items' => [
+ ['title' => 'a title1'],
+ ['title' => 'a title2', 'status' => 4],
+ ['title' => 'a title3', 'status' => 6],
+ ['title' => 'del1', 'status' => 0],
+ ['title' => 'del2', 'status' => 0],
+ ['title' => 'del3', 'status' => 0],
+ ['title' => 'del4', 'status' => 0]
+ ]
+ ],
+ [
+ 'title' => 'second feed',
+ 'url' => 'http://golem.de',
+ 'items' => []
+ ],
+ ],
+ ],
+ [
+ 'name' => 'second folder',
+ 'feeds' => [
+ [
+ 'title' => 'third feed',
+ 'url' => 'http://heise.de',
+ 'items' => [['title' => 'the title9']]
+ ],
+ [
+ 'title' => 'sixth feed',
+ 'url' => 'http://gremlins.de',
+ 'deletedAt' => 999999999,
+ 'items' => [['title' => 'not found feed']]
+ ]
+ ],
+ ],
+ [
+ 'name' => 'third folder',
+ 'deletedAt' => 9999999999,
+ 'feeds' => [
+ [
+ 'title' => 'fifth feed',
+ 'url' => 'http://prolinux.de',
+ 'items' => [['title' => 'not found folder']]
+ ]
+ ],
+ ]
+ ],
+ 'feeds' => [
+ [
+ 'title' => 'fourth feed',
+ 'url' => 'http://blog.fefe.de',
+ 'items' => [
+ ['title' => 'no folder', 'status' => 0]
+ ]
+ ]
+ ]
+]; \ No newline at end of file
diff --git a/tests/integration/fixtures/feeds.json b/tests/integration/fixtures/feeds.json
deleted file mode 100644
index 685a75396..000000000
--- a/tests/integration/fixtures/feeds.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "first folder": [
- {
- "title": "first feed",
- "url": "http://google.de",
- "deletedAt": 0,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 1,
- "lastModified": "",
- "etag": ""
- },
- {
- "title": "second feed",
- "url": "http://golem.de",
- "deletedAt": 0,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 40,
- "lastModified": "",
- "etag": ""
- }
- ],
- "second folder": [
- {
- "title": "third feed",
- "url": "http://heise.de",
- "deletedAt": 0,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 40,
- "lastModified": "",
- "etag": ""
- },
- {
- "title": "sixth feed",
- "url": "http://gremlins.de",
- "deletedAt": 999999999,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 40,
- "lastModified": "",
- "etag": ""
- }
- ],
- "no folder": [{
- "title": "fourth feed",
- "url": "http://blog.fefe.de",
- "deletedAt": 0,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 40,
- "lastModified": "",
- "etag": ""
- }
- ],
- "third folder": [{
- "title": "fifth feed",
- "url": "http://prolinux.de",
- "deletedAt": 0,
- "location": "http://feed.com/rss",
- "faviconLink": "Http://feed.com/favicon.ico",
- "added": 3000,
- "link": "http://feed.com/rss",
- "preventUpdate": false,
- "articlesPerUpdate": 40,
- "lastModified": "",
- "etag": ""
- }
- ]
-} \ No newline at end of file
diff --git a/tests/integration/fixtures/folders.json b/tests/integration/fixtures/folders.json
deleted file mode 100644
index 3c79ef52b..000000000
--- a/tests/integration/fixtures/folders.json
+++ /dev/null
@@ -1,17 +0,0 @@
-[
- {
- "name": "first folder",
- "deletedAt": 0,
- "opened": true
- },
- {
- "name": "second folder",
- "deletedAt": 0,
- "opened": false
- },
- {
- "name": "third folder",
- "deletedAt": 9999999999,
- "opened": true
- }
-] \ No newline at end of file
diff --git a/tests/integration/fixtures/items.json b/tests/integration/fixtures/items.json
deleted file mode 100644
index 5396fde9b..000000000
--- a/tests/integration/fixtures/items.json
+++ /dev/null
@@ -1,144 +0,0 @@
-{
- "first feed": [
- {
- "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"
- },
- {
- "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"
- }
- ],
- "third feed": [
- {
- "status": 2,
- "body": "this is a body",
- "title": "a title9",
- "author": "my author",
- "guid": "a title9",
- "url": "http://google.de",
- "pubDate": 2323,
- "lastModified": 113,
- "enclosureMime": "video/mpeg",
- "enclosureLink": "http://google.de/web.webm"
- }
- ],
- "fourth feed": [
- {
- "status": 0,
- "body": "this is a body",
- "title": "no folder",
- "author": "my author",
- "guid": "no folder",
- "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