summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSean Molenaar <SMillerDev@users.noreply.github.com>2018-03-27 15:35:06 +0200
committerBernhard Posselt <BernhardPosselt@users.noreply.github.com>2018-03-27 15:35:06 +0200
commit5b94705cf3918dc7986c6043b1fbe776bf22958f (patch)
tree4e8059818a0a913d24938e35238913a721fa6373 /tests
parentf3c9d13551cef5968baea99c2f25085baee0ed5f (diff)
Core: Fix compatibility with nextcloud codestyle (#280)
Diffstat (limited to 'tests')
-rw-r--r--tests/Integration/Db/FeedMapperTest.php99
-rw-r--r--tests/Integration/Db/FolderMapperTest.php8
-rw-r--r--tests/Integration/Db/ItemMapperTest.php59
-rw-r--r--tests/Integration/Fixtures/FeedFixture.php14
-rw-r--r--tests/Integration/Fixtures/Fixture.php8
-rw-r--r--tests/Integration/Fixtures/FolderFixture.php14
-rw-r--r--tests/Integration/Fixtures/ItemFixture.php14
-rw-r--r--tests/Integration/Fixtures/data/default.php2
-rw-r--r--tests/Integration/Fixtures/data/readitem.php2
-rw-r--r--tests/Integration/IntegrationTest.php90
-rw-r--r--tests/Unit/Config/ConfigTest.php83
-rw-r--r--tests/Unit/Controller/AdminControllerTest.php36
-rw-r--r--tests/Unit/Controller/EntityApiSerializerTest.php32
-rw-r--r--tests/Unit/Controller/ExportControllerTest.php41
-rw-r--r--tests/Unit/Controller/FeedApiControllerTest.php131
-rw-r--r--tests/Unit/Controller/FeedControllerTest.php144
-rw-r--r--tests/Unit/Controller/FolderApiControllerTest.php77
-rw-r--r--tests/Unit/Controller/FolderControllerTest.php50
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php179
-rw-r--r--tests/Unit/Controller/ItemControllerTest.php160
-rw-r--r--tests/Unit/Controller/JSONHttpErrorTest.php17
-rw-r--r--tests/Unit/Controller/PageControllerTest.php194
-rw-r--r--tests/Unit/Controller/UserApiControllerTest.php56
-rw-r--r--tests/Unit/Controller/UtilityApiControllerTest.php44
-rw-r--r--tests/Unit/Db/FeedTest.php41
-rw-r--r--tests/Unit/Db/FolderMapperTest.php38
-rw-r--r--tests/Unit/Db/FolderTest.php29
-rw-r--r--tests/Unit/Db/ItemTest.php99
-rw-r--r--tests/Unit/Db/MapperFactoryTest.php63
-rw-r--r--tests/Unit/Db/MapperTestUtility.php120
-rw-r--r--tests/Unit/Fetcher/FeedFetcherTest.php132
-rw-r--r--tests/Unit/Fetcher/FetcherTest.php71
-rw-r--r--tests/Unit/Fetcher/YoutubeFetcherTest.php20
-rw-r--r--tests/Unit/Http/TextDownloadResponseTest.php17
-rw-r--r--tests/Unit/Http/TextResponseTest.php23
-rw-r--r--tests/Unit/Migration/MigrateStatusFlagsTest.php29
-rw-r--r--tests/Unit/Service/FeedServiceTest.php266
-rw-r--r--tests/Unit/Service/FolderServiceTest.php68
-rw-r--r--tests/Unit/Service/ItemServiceTest.php239
-rw-r--r--tests/Unit/Service/ServiceTest.php32
-rw-r--r--tests/Unit/Service/StatusServiceTest.php50
-rw-r--r--tests/Unit/Utility/OPMLExporterTest.php98
-rw-r--r--tests/Unit/Utility/ProxyConfigParserTest.php32
-rw-r--r--tests/Unit/Utility/UpdaterTest.php38
-rw-r--r--tests/bootstrap.php2
45 files changed, 1958 insertions, 1103 deletions
diff --git a/tests/Integration/Db/FeedMapperTest.php b/tests/Integration/Db/FeedMapperTest.php
index bcf1cb895..3d1ea71f4 100644
--- a/tests/Integration/Db/FeedMapperTest.php
+++ b/tests/Integration/Db/FeedMapperTest.php
@@ -5,8 +5,8 @@
* 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>
- * @author Daniel Opitz <dev@copynpaste.de>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @author Daniel Opitz <dev@copynpaste.de>
* @copyright Bernhard Posselt 2015
* @copyright Daniel Opitz 2017
*/
@@ -17,9 +17,11 @@ use OCA\News\Db\Feed;
use OCA\News\Tests\Integration\IntegrationTest;
use OCA\News\Tests\Integration\Fixtures\FeedFixture;
-class FeedMapperTest extends IntegrationTest {
+class FeedMapperTest extends IntegrationTest
+{
- public function testFind () {
+ public function testFind()
+ {
$feed = new FeedFixture();
$feed = $this->feedMapper->insert($feed);
@@ -32,12 +34,14 @@ class FeedMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindNotExisting () {
+ public function testFindNotExisting()
+ {
$this->feedMapper->find(0, $this->user);
}
- public function testFindAll () {
+ public function testFindAll()
+ {
$feeds = [
[
'userId' => $this->user,
@@ -59,7 +63,8 @@ class FeedMapperTest extends IntegrationTest {
$this->tearDownUser('john');
}
- public function testFindAllEmpty () {
+ public function testFindAllEmpty()
+ {
$feeds = $this->feedMapper->findAll();
$this->assertInternalType('array', $feeds);
@@ -67,7 +72,8 @@ class FeedMapperTest extends IntegrationTest {
}
- public function testFindAllFromUser () {
+ public function testFindAllFromUser()
+ {
$feeds = [
[
'userId' => $this->user,
@@ -90,7 +96,8 @@ class FeedMapperTest extends IntegrationTest {
}
- public function testFindAllFromUserNotExisting () {
+ public function testFindAllFromUserNotExisting()
+ {
$fetched = $this->feedMapper->findAllFromUser('notexistinguser');
$this->assertInternalType('array', $fetched);
@@ -98,11 +105,14 @@ class FeedMapperTest extends IntegrationTest {
}
- public function testFindByUrlHash () {
- $feed = new FeedFixture([
+ public function testFindByUrlHash()
+ {
+ $feed = new FeedFixture(
+ [
'urlHash' => 'someTestHash',
'title' => 'Some Test Title'
- ]);
+ ]
+ );
$feed = $this->feedMapper->insert($feed);
$fetched = $this->feedMapper->findByUrlHash($feed->getUrlHash(), $this->user);
@@ -114,13 +124,22 @@ class FeedMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
- public function testFindByUrlHashMoreThanOneResult () {
- $feed1 = $this->feedMapper->insert(new FeedFixture([
- 'urlHash' => 'someTestHash'
- ]));
- $feed2 = $this->feedMapper->insert(new FeedFixture([
- 'urlHash' => 'someTestHash'
- ]));
+ public function testFindByUrlHashMoreThanOneResult()
+ {
+ $feed1 = $this->feedMapper->insert(
+ new FeedFixture(
+ [
+ 'urlHash' => 'someTestHash'
+ ]
+ )
+ );
+ $feed2 = $this->feedMapper->insert(
+ new FeedFixture(
+ [
+ 'urlHash' => 'someTestHash'
+ ]
+ )
+ );
$this->feedMapper->findByUrlHash($feed1->getUrlHash(), $this->user);
}
@@ -129,12 +148,14 @@ class FeedMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindByUrlHashNotExisting () {
+ public function testFindByUrlHashNotExisting()
+ {
$this->feedMapper->findByUrlHash('some random hash', $this->user);
}
- public function testDelete () {
+ public function testDelete()
+ {
$this->loadFixtures('default');
$feeds = $this->feedMapper->findAllFromUser($this->user);
@@ -157,13 +178,16 @@ class FeedMapperTest extends IntegrationTest {
$this->assertCount(0, $items);
}
- public function testGetToDelete () {
- $this->loadFeedFixtures([
+ public function testGetToDelete()
+ {
+ $this->loadFeedFixtures(
+ [
['deletedAt' => 1],
['deletedAt' => 0],
['deletedAt' => 1, 'userId' => 'john'],
['deletedAt' => 1000]
- ]);
+ ]
+ );
$fetched = $this->feedMapper->getToDelete();
@@ -174,13 +198,16 @@ class FeedMapperTest extends IntegrationTest {
$this->tearDownUser('john');
}
- public function testGetToDeleteOlderThan () {
- $this->loadFeedFixtures([
+ public function testGetToDeleteOlderThan()
+ {
+ $this->loadFeedFixtures(
+ [
['deletedAt' => 1],
['deletedAt' => 0],
['deletedAt' => 1, 'userId' => 'john'],
['deletedAt' => 1000]
- ]);
+ ]
+ );
$fetched = $this->feedMapper->getToDelete(1000);
@@ -191,13 +218,16 @@ class FeedMapperTest extends IntegrationTest {
$this->tearDownUser('john');
}
- public function testGetToDeleteUser () {
- $this->loadFeedFixtures([
+ public function testGetToDeleteUser()
+ {
+ $this->loadFeedFixtures(
+ [
['deletedAt' => 1],
['deletedAt' => 0],
['deletedAt' => 1, 'userId' => 'john'],
['deletedAt' => 1000]
- ]);
+ ]
+ );
$fetched = $this->feedMapper->getToDelete(2000, $this->user);
@@ -208,14 +238,16 @@ class FeedMapperTest extends IntegrationTest {
$this->tearDownUser('john');
}
- public function testGetToDeleteEmpty () {
+ public function testGetToDeleteEmpty()
+ {
$fetched = $this->feedMapper->getToDelete();
$this->assertInternalType('array', $fetched);
$this->assertCount(0, $fetched);
}
- public function testDeleteUser () {
+ public function testDeleteUser()
+ {
$this->loadFixtures('default');
$this->assertCount(4, $this->feedMapper->findAllFromUser($this->user));
@@ -231,7 +263,8 @@ class FeedMapperTest extends IntegrationTest {
$this->assertCount(0, $items);
}
- public function testDeleteUserNotExisting () {
+ public function testDeleteUserNotExisting()
+ {
$this->feedMapper->deleteUser('notexistinguser');
}
}
diff --git a/tests/Integration/Db/FolderMapperTest.php b/tests/Integration/Db/FolderMapperTest.php
index 4be407566..889ac3e7c 100644
--- a/tests/Integration/Db/FolderMapperTest.php
+++ b/tests/Integration/Db/FolderMapperTest.php
@@ -5,7 +5,7 @@
* 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>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2015
*/
@@ -13,10 +13,12 @@ namespace OCA\News\Tests\Integration\Db;
use OCA\News\Tests\Integration\IntegrationTest;
-class FolderMapperTest extends IntegrationTest {
+class FolderMapperTest extends IntegrationTest
+{
- public function testFind () {
+ public function testFind()
+ {
}
diff --git a/tests/Integration/Db/ItemMapperTest.php b/tests/Integration/Db/ItemMapperTest.php
index 546c43d85..c87a4139f 100644
--- a/tests/Integration/Db/ItemMapperTest.php
+++ b/tests/Integration/Db/ItemMapperTest.php
@@ -5,7 +5,7 @@
* 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>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2015
*/
@@ -15,9 +15,11 @@ use OCA\News\Tests\Integration\IntegrationTest;
use OCA\News\Tests\Integration\Fixtures\FeedFixture;
use OCA\News\Tests\Integration\Fixtures\ItemFixture;
-class ItemMapperTest extends IntegrationTest {
+class ItemMapperTest extends IntegrationTest
+{
- public function testFind() {
+ public function testFind()
+ {
$feed = new FeedFixture();
$feed = $this->feedMapper->insert($feed);
@@ -32,17 +34,20 @@ class ItemMapperTest extends IntegrationTest {
/**
* Same as whereId with easier title search
- * @param $title
+ *
+ * @param $title
* @return mixed
*/
- private function whereTitleId($title) {
+ private function whereTitleId($title)
+ {
return $this->findItemByTitle($title)->getId();
}
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindNotFoundWhenDeletedFeed() {
+ public function testFindNotFoundWhenDeletedFeed()
+ {
$this->loadFixtures('default');
$id = $this->whereTitleId('not found feed');
@@ -53,7 +58,8 @@ class ItemMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindNotFoundWhenDeletedFolder() {
+ public function testFindNotFoundWhenDeletedFolder()
+ {
$this->loadFixtures('default');
@@ -62,7 +68,8 @@ class ItemMapperTest extends IntegrationTest {
}
- private function deleteReadOlderThanThreshold() {
+ private function deleteReadOlderThanThreshold()
+ {
$this->loadFixtures('default');
$this->itemMapper->deleteReadOlderThanThreshold(1);
@@ -77,7 +84,8 @@ class ItemMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testDeleteOlderThanThresholdOne() {
+ public function testDeleteOlderThanThresholdOne()
+ {
$this->loadFixtures('default');
$id = $this->whereTitleId('del1');
@@ -89,7 +97,8 @@ class ItemMapperTest extends IntegrationTest {
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testDeleteOlderThanThresholdTwo() {
+ public function testDeleteOlderThanThresholdTwo()
+ {
$this->loadFixtures('default');
$id = $this->whereTitleId('del2');
@@ -99,7 +108,8 @@ class ItemMapperTest extends IntegrationTest {
}
- public function testStarredCount () {
+ public function testStarredCount()
+ {
$this->loadFixtures('default');
$count = $this->itemMapper->starredCount($this->user);
@@ -107,7 +117,8 @@ class ItemMapperTest extends IntegrationTest {
}
- public function testReadAll () {
+ public function testReadAll()
+ {
$this->loadFixtures('default');
$this->itemMapper->readAll(PHP_INT_MAX, 10, $this->user);
@@ -135,7 +146,8 @@ class ItemMapperTest extends IntegrationTest {
}
- public function testReadFolder () {
+ public function testReadFolder()
+ {
$this->loadFixtures('default');
$folderId = $this->findFolderByName('first folder')->getId();
@@ -166,7 +178,8 @@ class ItemMapperTest extends IntegrationTest {
}
- public function testReadFeed () {
+ public function testReadFeed()
+ {
$this->loadFixtures('default');
$feedId = $this->findFeedByTitle('third feed')->getId();
@@ -196,7 +209,8 @@ class ItemMapperTest extends IntegrationTest {
}
- public function testDeleteUser () {
+ public function testDeleteUser()
+ {
$this->loadFixtures('default');
$this->itemMapper->deleteUser($this->user);
@@ -205,7 +219,8 @@ class ItemMapperTest extends IntegrationTest {
$this->assertEquals(0, $id);
}
- public function testGetNewestItemId () {
+ public function testGetNewestItemId()
+ {
$this->loadFixtures('default');
$id = $this->itemMapper->getNewestItemId($this->user);
@@ -214,7 +229,8 @@ class ItemMapperTest extends IntegrationTest {
$this->assertEquals($itemId, $id);
}
- public function testFindAllUnreadOrStarred () {
+ public function testFindAllUnreadOrStarred()
+ {
$this->loadFixtures('default');
$items = $this->itemMapper->findAllUnreadOrStarred($this->user);
@@ -222,7 +238,8 @@ class ItemMapperTest extends IntegrationTest {