diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-07-23 21:24:54 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-07-23 21:24:54 +0200 |
commit | 004fcbbcc7609ca83807f2e38967ef54f469bf72 (patch) | |
tree | 49eb99b4ea92b2045793fc567f719b31ec7f9042 /tests/Integration/Fixtures | |
parent | 60abc0ed4438c9b6fda245b0dc33cb483bc2aeaf (diff) |
Move to new directory structure
Diffstat (limited to 'tests/Integration/Fixtures')
-rw-r--r-- | tests/Integration/Fixtures/FeedFixture.php | 50 | ||||
-rw-r--r-- | tests/Integration/Fixtures/Fixture.php | 25 | ||||
-rw-r--r-- | tests/Integration/Fixtures/FolderFixture.php | 35 | ||||
-rw-r--r-- | tests/Integration/Fixtures/ItemFixture.php | 49 | ||||
-rw-r--r-- | tests/Integration/Fixtures/data/default.php | 76 | ||||
-rw-r--r-- | tests/Integration/Fixtures/data/readitem.php | 33 |
6 files changed, 268 insertions, 0 deletions
diff --git a/tests/Integration/Fixtures/FeedFixture.php b/tests/Integration/Fixtures/FeedFixture.php new file mode 100644 index 000000000..eafcab906 --- /dev/null +++ b/tests/Integration/Fixtures/FeedFixture.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 Bernhard Posselt <dev@bernhard-posselt.com> + * @copyright Bernhard Posselt 2015 + */ + + +namespace OCA\News\Tests\Integration\Fixtures; + + +use OCA\News\Db\Feed; + +class FeedFixture extends Feed { + + use Fixture; + + public function __construct(array $defaults=[]) { + parent::__construct(); + $defaults = array_merge([ + 'userId' => 'test', + 'urlHash' => 'urlHash', + 'url' => 'http://the.url.com', + 'title' => 'title', + 'faviconLink' => 'http://feed.com/favicon.ico', + 'added' => 3000, + 'folderId' => 0, + 'link' => 'http://feed.com/rss', + 'preventUpdate' => false, + 'deletedAt' => 0, + 'articlesPerUpdate' => 40, + 'httpLastModified' => 10, + 'httpEtag' => '', + 'location' => 'http://feed.com/rss', + 'ordering' => 0, + 'fullTextEnabled' => false, + 'pinned' => false, + 'updateMode' => 0, + 'updateErrorCount' => 0, + 'lastUpdateError' => '', + ], $defaults); + unset($defaults['items']); + $this->fillDefaults($defaults); + } + +} diff --git a/tests/Integration/Fixtures/Fixture.php b/tests/Integration/Fixtures/Fixture.php new file mode 100644 index 000000000..a5bceda17 --- /dev/null +++ b/tests/Integration/Fixtures/Fixture.php @@ -0,0 +1,25 @@ +<?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; + + +trait Fixture { + + protected function fillDefaults(array $defaults=[]) { + foreach ($defaults as $key => $value) { + $method = 'set' . ucfirst($key); + $this->$method($value); + } + } + +}
\ No newline at end of file diff --git a/tests/Integration/Fixtures/FolderFixture.php b/tests/Integration/Fixtures/FolderFixture.php new file mode 100644 index 000000000..2dc6b3a44 --- /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_merge([ + 'parentId' => 0, + 'name' => 'folder', + 'userId' => 'test', + 'opened' => true, + 'deletedAt' => 0, + 'lastModified' => 9 + ], $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..9e6e07fe2 --- /dev/null +++ b/tests/Integration/Fixtures/ItemFixture.php @@ -0,0 +1,49 @@ +<?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_merge([ + 'url' => 'http://google.de', + 'title' => 'title', + 'author' => 'my 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); + + if (!array_key_exists('guid', $defaults)) { + $defaults['guid'] = $defaults['title']; + } + + if (!array_key_exists('guidHash', $defaults)) { + $defaults['guidHash'] = $defaults['guid']; + } + + $this->fillDefaults($defaults); + $this->generateSearchIndex(); + } + +} diff --git a/tests/Integration/Fixtures/data/default.php b/tests/Integration/Fixtures/data/default.php new file mode 100644 index 000000000..d1383c3f7 --- /dev/null +++ b/tests/Integration/Fixtures/data/default.php @@ -0,0 +1,76 @@ +<?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', + 'articlesPerUpdate' => 1, + 'items' => [ + ['title' => 'a title1', 'guid' => 'abc'], + ['title' => 'a title2', 'status' => 4, 'guid' => 'def'], + ['title' => 'a title3', 'status' => 6, 'guid' => 'gih'], + ['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', + 'opened' => false, + 'feeds' => [ + [ + 'title' => 'third feed', + 'url' => 'http://heise.de', + 'items' => [['title' => 'a title9']] + ], + [ + 'title' => 'sixth feed', + 'url' => 'http://gremlins.de', + 'deletedAt' => 999999999, + 'items' => [['title' => 'not found feed', 'guid' => 'not found']] + ] + ], + ], + [ + 'name' => 'third folder', + 'deletedAt' => 9999999999, + 'feeds' => [ + [ + 'title' => 'fifth feed', + 'url' => 'http://prolinux.de', + 'items' => [['title' => 'not found folder', 'guid' => 'not found']] + ] + ], + ] + ], + '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/data/readitem.php b/tests/Integration/Fixtures/data/readitem.php new file mode 100644 index 000000000..7e3d68fad --- /dev/null +++ b/tests/Integration/Fixtures/data/readitem.php @@ -0,0 +1,33 @@ +<?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 [ + 'feeds' => [ + [ + 'title' => 'john feed', + 'userId' => 'john', + 'items' => [ + ['title' => 'blubb', 'status' => 2], + ['title' => 'blubb', 'status' => 2] + ] + ], + [ + 'title' => 'test feed', + 'userId' => 'test', + 'items' => [ + ['title' => 'blubb', 'status' => 2], + ['title' => 'blubbs', 'status' => 2], + ['title' => 'blubb', 'status' => 2], + ['title' => 'blubb', 'status' => 2] + ] + ] + ] +]; |