summaryrefslogtreecommitdiffstats
path: root/tests/Integration
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-09-20 22:03:05 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-09-25 19:18:04 +0200
commit60ab4941cc7e6ede095e9e4aee3c2bf9a5c3bff6 (patch)
treebaf0b07dd1c545efeb59437af46a99f4d9f69425 /tests/Integration
parent2c8b4fa019749113658b9ed8cae211b679e4cbc0 (diff)
Move to nextcloud config and update phpunit
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Integration')
-rw-r--r--tests/Integration/Db/FeedMapperTest.php57
-rw-r--r--tests/Integration/Db/FolderMapperTest.php53
-rw-r--r--tests/Integration/Db/ItemMapperTest.php36
3 files changed, 50 insertions, 96 deletions
diff --git a/tests/Integration/Db/FeedMapperTest.php b/tests/Integration/Db/FeedMapperTest.php
index 3d1ea71f4..626b8f9a9 100644
--- a/tests/Integration/Db/FeedMapperTest.php
+++ b/tests/Integration/Db/FeedMapperTest.php
@@ -20,7 +20,7 @@ use OCA\News\Tests\Integration\Fixtures\FeedFixture;
class FeedMapperTest extends IntegrationTest
{
- public function testFind()
+ public function testFind()
{
$feed = new FeedFixture();
$feed = $this->feedMapper->insert($feed);
@@ -31,16 +31,14 @@ class FeedMapperTest extends IntegrationTest
$this->assertEquals($feed->getLink(), $fetched->getLink());
}
- /**
- * @expectedException OCP\AppFramework\Db\DoesNotExistException
- */
- public function testFindNotExisting()
+ public function testFindNotExisting()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->feedMapper->find(0, $this->user);
}
- public function testFindAll()
+ public function testFindAll()
{
$feeds = [
[
@@ -56,23 +54,23 @@ class FeedMapperTest extends IntegrationTest
$fetched = $this->feedMapper->findAll();
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(2, $fetched);
$this->assertContainsOnlyInstancesOf(Feed::class, $fetched);
$this->tearDownUser('john');
}
- public function testFindAllEmpty()
+ public function testFindAllEmpty()
{
$feeds = $this->feedMapper->findAll();
- $this->assertInternalType('array', $feeds);
+ $this->assertIsArray($feeds);
$this->assertCount(0, $feeds);
}
- public function testFindAllFromUser()
+ public function testFindAllFromUser()
{
$feeds = [
[
@@ -88,7 +86,7 @@ class FeedMapperTest extends IntegrationTest
$fetched = $this->feedMapper->findAllFromUser($this->user);
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(1, $fetched);
$this->assertContainsOnlyInstancesOf(Feed::class, $fetched);
@@ -96,16 +94,16 @@ class FeedMapperTest extends IntegrationTest
}
- public function testFindAllFromUserNotExisting()
+ public function testFindAllFromUserNotExisting()
{
$fetched = $this->feedMapper->findAllFromUser('notexistinguser');
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(0, $fetched);
}
- public function testFindByUrlHash()
+ public function testFindByUrlHash()
{
$feed = new FeedFixture(
[
@@ -124,8 +122,9 @@ class FeedMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
- public function testFindByUrlHashMoreThanOneResult()
+ public function testFindByUrlHashMoreThanOneResult()
{
+ $this->expectException('OCP\AppFramework\Db\MultipleObjectsReturnedException');
$feed1 = $this->feedMapper->insert(
new FeedFixture(
[
@@ -148,13 +147,14 @@ class FeedMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindByUrlHashNotExisting()
+ public function testFindByUrlHashNotExisting()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->feedMapper->findByUrlHash('some random hash', $this->user);
}
- public function testDelete()
+ public function testDelete()
{
$this->loadFixtures('default');
@@ -178,7 +178,7 @@ class FeedMapperTest extends IntegrationTest
$this->assertCount(0, $items);
}
- public function testGetToDelete()
+ public function testGetToDelete()
{
$this->loadFeedFixtures(
[
@@ -191,14 +191,14 @@ class FeedMapperTest extends IntegrationTest
$fetched = $this->feedMapper->getToDelete();
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(3, $fetched);
$this->assertContainsOnlyInstancesOf(Feed::class, $fetched);
$this->tearDownUser('john');
}
- public function testGetToDeleteOlderThan()
+ public function testGetToDeleteOlderThan()
{
$this->loadFeedFixtures(
[
@@ -211,14 +211,14 @@ class FeedMapperTest extends IntegrationTest
$fetched = $this->feedMapper->getToDelete(1000);
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(2, $fetched);
$this->assertContainsOnlyInstancesOf(Feed::class, $fetched);
$this->tearDownUser('john');
}
- public function testGetToDeleteUser()
+ public function testGetToDeleteUser()
{
$this->loadFeedFixtures(
[
@@ -231,22 +231,22 @@ class FeedMapperTest extends IntegrationTest
$fetched = $this->feedMapper->getToDelete(2000, $this->user);
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(2, $fetched);
$this->assertContainsOnlyInstancesOf(Feed::class, $fetched);
$this->tearDownUser('john');
}
- public function testGetToDeleteEmpty()
+ public function testGetToDeleteEmpty()
{
$fetched = $this->feedMapper->getToDelete();
- $this->assertInternalType('array', $fetched);
+ $this->assertIsArray($fetched);
$this->assertCount(0, $fetched);
}
- public function testDeleteUser()
+ public function testDeleteUser()
{
$this->loadFixtures('default');
@@ -263,7 +263,10 @@ class FeedMapperTest extends IntegrationTest
$this->assertCount(0, $items);
}
- public function testDeleteUserNotExisting()
+ /**
+ * @coversNothing
+ */
+ public function testDeleteUserNotExisting()
{
$this->feedMapper->deleteUser('notexistinguser');
}
diff --git a/tests/Integration/Db/FolderMapperTest.php b/tests/Integration/Db/FolderMapperTest.php
deleted file mode 100644
index 889ac3e7c..000000000
--- a/tests/Integration/Db/FolderMapperTest.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Nextcloud - 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\Db;
-
-use OCA\News\Tests\Integration\IntegrationTest;
-
-class FolderMapperTest extends IntegrationTest
-{
-
-
- public function testFind()
- {
-
- }
-
-
- /* TBD
- public function testFindByName () {
-
- }
-
-
- public function testFindAllFromUser () {
-
- }
-
-
- public function testDelete () {
-
- }
-
-
- public function testGetToDelete () {
-
- }
-
-
- public function testDeleteUser () {
-
- }*/
-
-
-
-}
diff --git a/tests/Integration/Db/ItemMapperTest.php b/tests/Integration/Db/ItemMapperTest.php
index e510aab96..026834e6b 100644
--- a/tests/Integration/Db/ItemMapperTest.php
+++ b/tests/Integration/Db/ItemMapperTest.php
@@ -18,7 +18,7 @@ use OCA\News\Tests\Integration\Fixtures\ItemFixture;
class ItemMapperTest extends IntegrationTest
{
- public function testFind()
+ public function testFind()
{
$feed = new FeedFixture();
$feed = $this->feedMapper->insert($feed);
@@ -38,7 +38,7 @@ class ItemMapperTest extends IntegrationTest
* @param $title
* @return mixed
*/
- private function whereTitleId($title)
+ private function whereTitleId($title)
{
return $this->findItemByTitle($title)->getId();
}
@@ -46,8 +46,9 @@ class ItemMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindNotFoundWhenDeletedFeed()
+ public function testFindNotFoundWhenDeletedFeed()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->loadFixtures('default');
$id = $this->whereTitleId('not found feed');
@@ -58,8 +59,9 @@ class ItemMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testFindNotFoundWhenDeletedFolder()
+ public function testFindNotFoundWhenDeletedFolder()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->loadFixtures('default');
@@ -68,7 +70,7 @@ class ItemMapperTest extends IntegrationTest
}
- private function deleteReadOlderThanThreshold()
+ private function deleteReadOlderThanThreshold()
{
$this->loadFixtures('default');
@@ -84,8 +86,9 @@ class ItemMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testDeleteOlderThanThresholdOne()
+ public function testDeleteOlderThanThresholdOne()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->loadFixtures('default');
$id = $this->whereTitleId('del1');
@@ -97,8 +100,9 @@ class ItemMapperTest extends IntegrationTest
/**
* @expectedException OCP\AppFramework\Db\DoesNotExistException
*/
- public function testDeleteOlderThanThresholdTwo()
+ public function testDeleteOlderThanThresholdTwo()
{
+ $this->expectException('OCP\AppFramework\Db\DoesNotExistException');
$this->loadFixtures('default');
$id = $this->whereTitleId('del2');
@@ -108,7 +112,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testStarredCount()
+ public function testStarredCount()
{
$this->loadFixtures('default');
@@ -117,7 +121,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testReadAll()
+ public function testReadAll()
{
$this->loadFixtures('default');
@@ -146,7 +150,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testReadFolder()
+ public function testReadFolder()
{
$this->loadFixtures('default');
@@ -178,7 +182,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testReadFeed()
+ public function testReadFeed()
{
$this->loadFixtures('default');
@@ -209,7 +213,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testDeleteUser()
+ public function testDeleteUser()
{
$this->loadFixtures('default');
@@ -219,7 +223,7 @@ class ItemMapperTest extends IntegrationTest
$this->assertEquals(0, $id);
}
- public function testGetNewestItemId()
+ public function testGetNewestItemId()
{
$this->loadFixtures('default');
@@ -229,7 +233,7 @@ class ItemMapperTest extends IntegrationTest
$this->assertEquals($itemId, $id);
}
- public function testFindAllUnreadOrStarred()
+ public function testFindAllUnreadOrStarred()
{
$this->loadFixtures('default');
@@ -238,7 +242,7 @@ class ItemMapperTest extends IntegrationTest
}
- public function testReadItem()
+ public function testReadItem()
{
$this->loadFixtures('readitem');
// assert that all items are unread
@@ -277,7 +281,7 @@ class ItemMapperTest extends IntegrationTest
}
}
- public function testUnreadItem()
+ public function testUnreadItem()
{
$this->loadFixtures('readitem');
// unread an item