diff options
author | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2018-03-27 15:35:06 +0200 |
---|---|---|
committer | Bernhard Posselt <BernhardPosselt@users.noreply.github.com> | 2018-03-27 15:35:06 +0200 |
commit | 5b94705cf3918dc7986c6043b1fbe776bf22958f (patch) | |
tree | 4e8059818a0a913d24938e35238913a721fa6373 /tests/Integration | |
parent | f3c9d13551cef5968baea99c2f25085baee0ed5f (diff) |
Core: Fix compatibility with nextcloud codestyle (#280)
Diffstat (limited to 'tests/Integration')
-rw-r--r-- | tests/Integration/Db/FeedMapperTest.php | 99 | ||||
-rw-r--r-- | tests/Integration/Db/FolderMapperTest.php | 8 | ||||
-rw-r--r-- | tests/Integration/Db/ItemMapperTest.php | 59 | ||||
-rw-r--r-- | tests/Integration/Fixtures/FeedFixture.php | 14 | ||||
-rw-r--r-- | tests/Integration/Fixtures/Fixture.php | 8 | ||||
-rw-r--r-- | tests/Integration/Fixtures/FolderFixture.php | 14 | ||||
-rw-r--r-- | tests/Integration/Fixtures/ItemFixture.php | 14 | ||||
-rw-r--r-- | tests/Integration/Fixtures/data/default.php | 2 | ||||
-rw-r--r-- | tests/Integration/Fixtures/data/readitem.php | 2 | ||||
-rw-r--r-- | tests/Integration/IntegrationTest.php | 90 |
10 files changed, 205 insertions, 105 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 { } - public function testReadItem() { + public function testReadItem() + { $this->loadFixtures('readitem'); // assert that all items are unread $feed = $this->feedMapper->where(['userId' => 'john'])[0]; @@ -260,7 +277,8 @@ class ItemMapperTest extends IntegrationTest { } } - public function testUnreadItem() { + public function testUnreadItem() + { $this->loadFixtures('readitem'); // unread an item $feed = $this->feedMapper->where(['userId' => 'test'])[0]; @@ -286,7 +304,8 @@ class ItemMapperTest extends IntegrationTest { } } - protected function tearDown() { + protected function tearDown() + { parent::tearDown(); $this->clearUserNewsDatabase('john'); } diff --git a/tests/Integration/Fixtures/FeedFixture.php b/tests/Integration/Fixtures/FeedFixture.php index 3d7617a57..66461adbc 100644 --- a/tests/Integration/Fixtures/FeedFixture.php +++ b/tests/Integration/Fixtures/FeedFixture.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,13 +15,16 @@ namespace OCA\News\Tests\Integration\Fixtures; use OCA\News\Db\Feed; -class FeedFixture extends Feed { +class FeedFixture extends Feed +{ use Fixture; - public function __construct(array $defaults=[]) { + public function __construct(array $defaults=[]) + { parent::__construct(); - $defaults = array_merge([ + $defaults = array_merge( + [ 'userId' => 'test', 'urlHash' => 'urlHash', 'url' => 'http://the.url.com', @@ -42,7 +45,8 @@ class FeedFixture extends Feed { 'updateMode' => 0, 'updateErrorCount' => 0, 'lastUpdateError' => '', - ], $defaults); + ], $defaults + ); unset($defaults['items']); $this->fillDefaults($defaults); } diff --git a/tests/Integration/Fixtures/Fixture.php b/tests/Integration/Fixtures/Fixture.php index f17beb25c..1874c8102 100644 --- a/tests/Integration/Fixtures/Fixture.php +++ b/tests/Integration/Fixtures/Fixture.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,9 +13,11 @@ namespace OCA\News\Tests\Integration\Fixtures; -trait Fixture { +trait Fixture +{ - protected function fillDefaults(array $defaults=[]) { + protected function fillDefaults(array $defaults=[]) + { foreach ($defaults as $key => $value) { $method = 'set' . ucfirst($key); $this->$method($value); diff --git a/tests/Integration/Fixtures/FolderFixture.php b/tests/Integration/Fixtures/FolderFixture.php index 150557b8b..2564e8b71 100644 --- a/tests/Integration/Fixtures/FolderFixture.php +++ b/tests/Integration/Fixtures/FolderFixture.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,19 +15,23 @@ namespace OCA\News\Tests\Integration\Fixtures; use OCA\News\Db\Folder; -class FolderFixture extends Folder { +class FolderFixture extends Folder +{ use Fixture; - public function __construct(array $defaults=[]) { + public function __construct(array $defaults=[]) + { parent::__construct(); - $defaults = array_merge([ + $defaults = array_merge( + [ 'parentId' => 0, 'name' => 'folder', 'userId' => 'test', 'opened' => true, 'deletedAt' => 0, 'lastModified' => 9 - ], $defaults); + ], $defaults + ); unset($defaults['feeds']); $this->fillDefaults($defaults); } diff --git a/tests/Integration/Fixtures/ItemFixture.php b/tests/Integration/Fixtures/ItemFixture.php index 0832b0ef4..450b56f82 100644 --- a/tests/Integration/Fixtures/ItemFixture.php +++ b/tests/Integration/Fixtures/ItemFixture.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,12 +15,15 @@ namespace OCA\News\Tests\Integration\Fixtures; use OCA\News\Db\Item; -class ItemFixture extends Item { +class ItemFixture extends Item +{ use Fixture; - public function __construct(array $defaults=[]) { + public function __construct(array $defaults=[]) + { parent::__construct(); - $defaults = array_merge([ + $defaults = array_merge( + [ 'url' => 'http://google.de', 'title' => 'title', 'author' => 'my author', @@ -33,7 +36,8 @@ class ItemFixture extends Item { 'starred' => false, 'lastModified' => 113, 'rtl' => false, - ], $defaults); + ], $defaults + ); if (!array_key_exists('guid', $defaults)) { $defaults['guid'] = $defaults['title']; diff --git a/tests/Integration/Fixtures/data/default.php b/tests/Integration/Fixtures/data/default.php index 862515b12..41935b5c6 100644 --- a/tests/Integration/Fixtures/data/default.php +++ b/tests/Integration/Fixtures/data/default.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 */ diff --git a/tests/Integration/Fixtures/data/readitem.php b/tests/Integration/Fixtures/data/readitem.php index 8f953a845..425492741 100644 --- a/tests/Integration/Fixtures/data/readitem.php +++ b/tests/Integration/Fixtures/data/readitem.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 */ diff --git a/tests/Integration/IntegrationTest.php b/tests/Integration/IntegrationTest.php index f14a1263b..751cbe5fd 100644 --- a/tests/Integration/IntegrationTest.php +++ b/tests/Integration/IntegrationTest.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 */ @@ -32,24 +32,34 @@ use OCA\News\Db\ItemMapper; use OCA\News\Db\FolderMapper; -abstract class IntegrationTest extends \Test\TestCase { +abstract class IntegrationTest extends \Test\TestCase +{ protected $user = 'test'; protected $userPassword = 'test'; - /** @var ItemMapper */ + /** + * @var ItemMapper + */ protected $itemMapper; - /** @var FeedMapper */ + /** + * @var FeedMapper + */ protected $feedMapper; - /** @var FolderMapper */ + /** + * @var FolderMapper + */ protected $folderMapper; - /** @var IAppContainer */ + /** + * @var IAppContainer + */ protected $container; - protected function setUp() { + protected function setUp() + { parent::setUp(); $app = new Application(); $this->container = $app->getContainer(); @@ -62,7 +72,8 @@ abstract class IntegrationTest extends \Test\TestCase { $this->folderMapper = $this->container->query(FolderMapper::class); } - protected function findItemByTitle($title) { + protected function findItemByTitle($title) + { // db logic in app code, negligible since its a test $items = $this->itemMapper->where(['title' => $title]); $feeds = $this->feedMapper->where(['userId' => $this->user]); @@ -72,10 +83,12 @@ abstract class IntegrationTest extends \Test\TestCase { $feedIds[$feed->getId()] = true; } - $result = array_filter($items, + $result = array_filter( + $items, function (Item $item) use ($feedIds) { - return array_key_exists($item->getFeedId(), $feedIds); - }); + return array_key_exists($item->getFeedId(), $feedIds); + } + ); // ok so this is funny: array_filter preserves indices, meaning that // you can't use 0 as key for the first element return from it :D @@ -84,24 +97,31 @@ abstract class IntegrationTest extends \Test\TestCase { return $result; } - protected function findFolderByName($name) { - return $this->folderMapper->where([ + protected function findFolderByName($name) + { + return $this->folderMapper->where( + [ 'userId' => $this->user, 'name' => $name - ])[0]; + ] + )[0]; } - protected function findFeedByTitle($title) { - return $this->feedMapper->where([ + protected function findFeedByTitle($title) + { + return $this->feedMapper->where( + [ 'userId' => $this->user, 'title' => $title - ])[0]; + ] + )[0]; } /** * @param string $name loads fixtures from a given file */ - protected function loadFixtures($name) { + protected function loadFixtures($name) + { $fixtures = include __DIR__ . '/Fixtures/data/' . $name . '.php'; if (array_key_exists('folders', $fixtures)) { $this->loadFolderFixtures($fixtures['folders']); @@ -111,7 +131,8 @@ abstract class IntegrationTest extends \Test\TestCase { } } - protected function loadFolderFixtures(array $folderFixtures=[]) { + protected function loadFolderFixtures(array $folderFixtures=[]) + { foreach ($folderFixtures as $folderFixture) { $folder = new FolderFixture($folderFixture); $folderId = $this->loadFixture($folder); @@ -119,19 +140,21 @@ abstract class IntegrationTest extends \Test\TestCase { } } - protected function loadFeedFixtures(array $feedFixtures=[], $folderId=0) { + protected function loadFeedFixtures(array $feedFixtures=[], $folderId=0) + { foreach ($feedFixtures as $feedFixture) { $feed = new FeedFixture($feedFixture); $feed->setFolderId($folderId); $feedId = $this->loadFixture($feed); if (!empty($feedFixture['items'])) { - $this->loadItemFixtures($feedFixture['items'], $feedId); - } + $this->loadItemFixtures($feedFixture['items'], $feedId); + } } } - protected function loadItemFixtures(array $itemFixtures=[], $feedId) { + protected function loadItemFixtures(array $itemFixtures=[], $feedId) + { foreach ($itemFixtures as $itemFixture) { $item = new ItemFixture($itemFixture); $item->setFeedId($feedId); @@ -141,10 +164,12 @@ abstract class IntegrationTest extends \Test\TestCase { /** * Saves a fixture in a database and returns the saved result - * @param Entity $fixture + * + * @param Entity $fixture * @return int the id */ - protected function loadFixture(Entity $fixture) { + protected function loadFixture(Entity $fixture) + { if ($fixture instanceof FeedFixture) { return $this->feedMapper->insert($fixture)->getId(); } elseif ($fixture instanceof ItemFixture) { @@ -158,10 +183,12 @@ abstract class IntegrationTest extends \Test\TestCase { /** * Creates and logs in a new ownCloud user + * * @param $user * @param $password */ - protected function setupUser($user, $password) { + protected function setupUser($user, $password) + { $userManager = $this->container->query(IUserManager::class); $userManager->createUser($user, $password); @@ -170,9 +197,11 @@ abstract class IntegrationTest extends \Test\TestCase { /** * Removes a user and his News app database entries from the database + * * @param $user */ - protected function tearDownUser($user) { + protected function tearDownUser($user) + { $userManager = $this->container->query(IUserManager::class); if ($userManager->userExists($user)) { @@ -184,9 +213,11 @@ abstract class IntegrationTest extends \Test\TestCase { /** * Deletes all news entries of a given user + * * @param string $user */ - protected function clearUserNewsDatabase($user) { + protected function clearUserNewsDatabase($user) + { $sql = [ 'DELETE FROM `*PREFIX*news_items` WHERE `feed_id` IN (SELECT `id` FROM `*PREFIX*news_feeds` WHERE `user_id` = ?)', @@ -200,7 +231,8 @@ abstract class IntegrationTest extends \Test\TestCase { } } - protected function tearDown() { + protected function tearDown() + { parent::tearDown(); $this->tearDownUser($this->user); } |