summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Controller')
-rw-r--r--tests/Unit/Controller/AdminControllerTest.php161
-rw-r--r--tests/Unit/Controller/ExportControllerTest.php2
-rw-r--r--tests/Unit/Controller/FeedApiControllerTest.php32
-rw-r--r--tests/Unit/Controller/FeedControllerTest.php10
-rw-r--r--tests/Unit/Controller/FolderApiControllerTest.php24
-rw-r--r--tests/Unit/Controller/FolderControllerTest.php2
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php38
-rw-r--r--tests/Unit/Controller/ItemControllerTest.php6
-rw-r--r--tests/Unit/Controller/JSONHttpErrorTest.php2
-rw-r--r--tests/Unit/Controller/PageControllerTest.php241
-rw-r--r--tests/Unit/Controller/UserApiControllerTest.php12
-rw-r--r--tests/Unit/Controller/UtilityApiControllerTest.php2
12 files changed, 215 insertions, 317 deletions
diff --git a/tests/Unit/Controller/AdminControllerTest.php b/tests/Unit/Controller/AdminControllerTest.php
index b0b551006..81490bb6f 100644
--- a/tests/Unit/Controller/AdminControllerTest.php
+++ b/tests/Unit/Controller/AdminControllerTest.php
@@ -13,82 +13,84 @@
namespace OCA\News\Tests\Unit\Controller;
-use OCA\News\Config\Config;
use OCA\News\Controller\AdminController;
use OCA\News\Service\ItemService;
+use OCP\IConfig;
use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class AdminControllerTest extends TestCase
{
-
+ /**
+ * @var string
+ */
private $appName;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IRequest
+ */
private $request;
+
+ /**
+ * @var AdminController
+ */
private $controller;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IConfig
+ */
private $config;
- private $configPath;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|ItemService
+ */
private $itemService;
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
$this->appName = 'news';
$this->request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder(Config::class)
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->itemService = $this->getMockBuilder(ItemService::class)
->disableOriginalConstructor()
->getMock();
- $this->configPath = 'my.ini';
- $this->controller = new AdminController(
- $this->appName, $this->request,
- $this->config, $this->itemService, $this->configPath
- );
+ $this->controller = new AdminController($this->appName, $this->request, $this->config, $this->itemService);
}
-
- public function testIndex()
+ /**
+ * Test \OCA\News\Controller\AdminController::index
+ */
+ public function testIndex()
{
$expected = [
'autoPurgeMinimumInterval' => 1,
'autoPurgeCount' => 2,
'maxRedirects' => 3,
'feedFetcherTimeout' => 4,
- 'useCronUpdates' => 5,
- 'maxSize' => 7,
+ 'useCronUpdates' => false,
'exploreUrl' => 'test',
- 'updateInterval' => 3600
+ 'updateInterval' => 3601
];
- $this->config->expects($this->once())
- ->method('getAutoPurgeMinimumInterval')
- ->will($this->returnValue($expected['autoPurgeMinimumInterval']));
- $this->config->expects($this->once())
- ->method('getAutoPurgeCount')
- ->will($this->returnValue($expected['autoPurgeCount']));
- $this->config->expects($this->once())
- ->method('getMaxRedirects')
- ->will($this->returnValue($expected['maxRedirects']));
- $this->config->expects($this->once())
- ->method('getFeedFetcherTimeout')
- ->will($this->returnValue($expected['feedFetcherTimeout']));
- $this->config->expects($this->once())
- ->method('getUseCronUpdates')
- ->will($this->returnValue($expected['useCronUpdates']));
- $this->config->expects($this->once())
- ->method('getMaxSize')
- ->will($this->returnValue($expected['maxSize']));
- $this->config->expects($this->once())
- ->method('getExploreUrl')
- ->will($this->returnValue($expected['exploreUrl']));
- $this->config->expects($this->once())
- ->method('getUpdateInterval')
- ->will($this->returnValue($expected['updateInterval']));
+ $map = [
+ ['news','autoPurgeMinimumInterval', 60, 1],
+ ['news','autoPurgeCount', 200, 2],
+ ['news','maxRedirects', 10, 3],
+ ['news','feedFetcherTimeout', 60, 4],
+ ['news','useCronUpdates', true, false,],
+ ['news','exploreUrl', '', 'test'],
+ ['news','updateInterval', 3600, 3601]
+ ];
+ $this->config->expects($this->exactly(count($map)))
+ ->method('getAppValue')
+ ->will($this->returnValueMap($map));
$response = $this->controller->index();
$data = $response->getParams();
@@ -101,75 +103,48 @@ class AdminControllerTest extends TestCase
}
- public function testUpdate()
+ public function testUpdate()
{
$expected = [
'autoPurgeMinimumInterval' => 1,
'autoPurgeCount' => 2,
'maxRedirects' => 3,
'feedFetcherTimeout' => 4,
- 'useCronUpdates' => 5,
- 'maxSize' => 7,
+ 'useCronUpdates' => false,
'exploreUrl' => 'test',
- 'updateInterval' => 3600
+ 'updateInterval' => 3601
];
- $this->config->expects($this->once())
- ->method('setAutoPurgeMinimumInterval')
- ->with($this->equalTo($expected['autoPurgeMinimumInterval']));
- $this->config->expects($this->once())
- ->method('setAutoPurgeCount')
- ->with($this->equalTo($expected['autoPurgeCount']));
- $this->config->expects($this->once())
- ->method('setMaxRedirects')
- ->with($this->equalTo($expected['maxRedirects']));
- $this->config->expects($this->once())
- ->method('setFeedFetcherTimeout')
- ->with($this->equalTo($expected['feedFetcherTimeout']));
- $this->config->expects($this->once())
- ->method('setUseCronUpdates')
- ->with($this->equalTo($expected['useCronUpdates']));
- $this->config->expects($this->once())
- ->method('setExploreUrl')
- ->with($this->equalTo($expected['exploreUrl']));
- $this->config->expects($this->once())
- ->method('setUpdateInterval')
- ->with($this->equalTo($expected['updateInterval']));
- $this->config->expects($this->once())
- ->method('write')
- ->with($this->equalTo($this->configPath));
-
- $this->config->expects($this->once())
- ->method('getAutoPurgeMinimumInterval')
- ->will($this->returnValue($expected['autoPurgeMinimumInterval']));
- $this->config->expects($this->once())
- ->method('getAutoPurgeCount')
- ->will($this->returnValue($expected['autoPurgeCount']));
- $this->config->expects($this->once())
- ->method('getMaxRedirects')
- ->will($this->returnValue($expected['maxRedirects']));
- $this->config->expects($this->once())
- ->method('getFeedFetcherTimeout')
- ->will($this->returnValue($expected['feedFetcherTimeout']));
- $this->config->expects($this->once())
- ->method('getUseCronUpdates')
- ->will($this->returnValue($expected['useCronUpdates']));
- $this->config->expects($this->once())
- ->method('getMaxSize')
- ->will($this->returnValue($expected['maxSize']));
- $this->config->expects($this->once())
- ->method('getExploreUrl')
- ->will($this->returnValue($expected['exploreUrl']));
- $this->config->expects($this->once())
- ->method('getUpdateInterval')
- ->will($this->returnValue($expected['updateInterval']));
+ $this->config->expects($this->exactly(count($expected)))
+ ->method('setAppValue')
+ ->withConsecutive(
+ ['news','autoPurgeMinimumInterval', 1],
+ ['news','autoPurgeCount', 2],
+ ['news','maxRedirects', 3],
+ ['news','feedFetcherTimeout', 4],
+ ['news','useCronUpdates', false],
+ ['news','exploreUrl', 'test'],
+ ['news','updateInterval', 3601]
+ );
+
+ $map = [
+ ['news','autoPurgeMinimumInterval', 60, 1],
+ ['news','autoPurgeCount', 200, 2],
+ ['news','maxRedirects', 10, 3],
+ ['news','feedFetcherTimeout', 60, 4],
+ ['news','useCronUpdates', true, false,],
+ ['news','exploreUrl', '', 'test'],
+ ['news','updateInterval', 3600, 3601]
+ ];
+ $this->config->expects($this->exactly(count($map)))
+ ->method('getAppValue')
+ ->will($this->returnValueMap($map));
$response = $this->controller->update(
$expected['autoPurgeMinimumInterval'],
$expected['autoPurgeCount'],
$expected['maxRedirects'],
$expected['feedFetcherTimeout'],
- $expected['maxSize'],
$expected['useCronUpdates'],
$expected['exploreUrl'],
$expected['updateInterval']
diff --git a/tests/Unit/Controller/ExportControllerTest.php b/tests/Unit/Controller/ExportControllerTest.php
index 84ded5c6f..94ffa1ed1 100644
--- a/tests/Unit/Controller/ExportControllerTest.php
+++ b/tests/Unit/Controller/ExportControllerTest.php
@@ -41,7 +41,7 @@ class ExportControllerTest extends TestCase
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
$this->appName = 'news';
$this->user = 'john';
diff --git a/tests/Unit/Controller/FeedApiControllerTest.php b/tests/Unit/Controller/FeedApiControllerTest.php
index cc387161d..c889a54b3 100644
--- a/tests/Unit/Controller/FeedApiControllerTest.php
+++ b/tests/Unit/Controller/FeedApiControllerTest.php
@@ -44,7 +44,7 @@ class FeedApiControllerTest extends TestCase
private $logger;
private $loggerParams;
- protected function setUp()
+ protected function setUp(): void
{
$this->loggerParams = ['hi'];
$this->logger = $this->getMockBuilder(ILogger::class)
@@ -85,7 +85,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testIndex()
+ public function testIndex()
{
$feeds = [new Feed()];
$starredCount = 3;
@@ -116,7 +116,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testIndexNoNewestItemId()
+ public function testIndexNoNewestItemId()
{
$feeds = [new Feed()];
$starredCount = 3;
@@ -145,7 +145,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testDelete()
+ public function testDelete()
{
$this->feedService->expects($this->once())
->method('delete')
@@ -158,7 +158,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testDeleteDoesNotExist()
+ public function testDeleteDoesNotExist()
{
$this->feedService->expects($this->once())
->method('delete')
@@ -176,7 +176,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testCreate()
+ public function testCreate()
{
$feeds = [new Feed()];
@@ -206,7 +206,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testCreateNoItems()
+ public function testCreateNoItems()
{
$feeds = [new Feed()];
@@ -236,7 +236,7 @@ class FeedApiControllerTest extends TestCase
- public function testCreateExists()
+ public function testCreateExists()
{
$this->feedService->expects($this->once())
->method('purgeDeleted')
@@ -255,7 +255,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testCreateError()
+ public function testCreateError()
{
$this->feedService->expects($this->once())
->method('create')
@@ -271,7 +271,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testRead()
+ public function testRead()
{
$this->itemService->expects($this->once())
->method('readFeed')
@@ -285,7 +285,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testMove()
+ public function testMove()
{
$this->feedService->expects($this->once())
->method('patch')
@@ -299,7 +299,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testMoveDoesNotExist()
+ public function testMoveDoesNotExist()
{
$this->feedService->expects($this->once())
->method('patch')
@@ -315,7 +315,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testRename()
+ public function testRename()
{
$feedId = 3;
$feedTitle = 'test';
@@ -332,7 +332,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testRenameError()
+ public function testRenameError()
{
$feedId = 3;
$feedTitle = 'test';
@@ -370,7 +370,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testUpdate()
+ public function testUpdate()
{
$feedId = 3;
$userId = 'hi';
@@ -383,7 +383,7 @@ class FeedApiControllerTest extends TestCase
}
- public function testUpdateError()
+ public function testUpdateError()
{
$feedId = 3;
$userId = 'hi';
diff --git a/tests/Unit/Controller/FeedControllerTest.php b/tests/Unit/Controller/FeedControllerTest.php
index 4703d307a..9a3114da0 100644
--- a/tests/Unit/Controller/FeedControllerTest.php
+++ b/tests/Unit/Controller/FeedControllerTest.php
@@ -45,7 +45,7 @@ class FeedControllerTest extends TestCase
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
$this->appName = 'news';
$this->user = 'jack';
@@ -398,7 +398,7 @@ class FeedControllerTest extends TestCase
}
- public function testImport()
+ public function testImport()
{
$feed = new Feed();
@@ -426,7 +426,7 @@ class FeedControllerTest extends TestCase
}
- public function testImportCreatesNoAdditionalFeed()
+ public function testImportCreatesNoAdditionalFeed()
{
$this->feedService->expects($this->once())
->method('importArticles')
@@ -467,7 +467,7 @@ class FeedControllerTest extends TestCase
}
- public function testRestore()
+ public function testRestore()
{
$this->feedService->expects($this->once())
->method('unmarkDeleted')
@@ -492,7 +492,7 @@ class FeedControllerTest extends TestCase
$this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND);
}
- public function testPatch()
+ public function testPatch()
{
$expected = [
'pinned' => true,
diff --git a/tests/Unit/Controller/FolderApiControllerTest.php b/tests/Unit/Controller/FolderApiControllerTest.php
index 3a93a460a..311212169 100644
--- a/tests/Unit/Controller/FolderApiControllerTest.php
+++ b/tests/Unit/Controller/FolderApiControllerTest.php
@@ -44,7 +44,7 @@ class FolderApiControllerTest extends TestCase
private $request;
private $msg;
- protected function setUp()
+ protected function setUp(): void
{
$this->appName = 'news';
$this->request = $this->getMockBuilder(IRequest::class)
@@ -79,7 +79,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testIndex()
+ public function testIndex()
{
$folders = [new Folder()];
@@ -98,7 +98,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testCreate()
+ public function testCreate()
{
$folderName = 'test';
$folder = new Folder();
@@ -122,7 +122,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testCreateAlreadyExists()
+ public function testCreateAlreadyExists()
{
$msg = 'exists';
@@ -141,7 +141,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testCreateInvalidFolderName()
+ public function testCreateInvalidFolderName()
{
$msg = 'exists';
@@ -162,7 +162,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testDelete()
+ public function testDelete()
{
$folderId = 23;
$this->folderService->expects($this->once())
@@ -173,7 +173,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testDeleteDoesNotExist()
+ public function testDeleteDoesNotExist()
{
$folderId = 23;
@@ -193,7 +193,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testUpdate()
+ public function testUpdate()
{
$folderId = 23;
$folderName = 'test';
@@ -209,7 +209,7 @@ class FolderApiControllerTest extends TestCase
$this->folderAPI->update($folderId, $folderName);
}
- public function testUpdateDoesNotExist()
+ public function testUpdateDoesNotExist()
{
$folderId = 23;
$folderName = 'test';
@@ -230,7 +230,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testUpdateExists()
+ public function testUpdateExists()
{
$folderId = 23;
$folderName = 'test';
@@ -251,7 +251,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testUpdateInvalidFolderName()
+ public function testUpdateInvalidFolderName()
{
$folderId = 23;
$folderName = '';
@@ -274,7 +274,7 @@ class FolderApiControllerTest extends TestCase
}
- public function testRead()
+ public function testRead()
{
$this->itemService->expects($this->once())
->method('readFolder')
diff --git a/tests/Unit/Controller/FolderControllerTest.php b/tests/Unit/Controller/FolderControllerTest.php
index b9e0485a4..abe1ebd7a 100644
--- a/tests/Unit/Controller/FolderControllerTest.php
+++ b/tests/Unit/Controller/FolderControllerTest.php
@@ -44,7 +44,7 @@ class FolderControllerTest extends TestCase
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
$this->appName = 'news';
$this->user = 'jack';
diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php
index 5733a0c87..412b9dd51 100644
--- a/tests/Unit/Controller/ItemApiControllerTest.php
+++ b/tests/Unit/Controller/ItemApiControllerTest.php
@@ -39,7 +39,7 @@ class ItemApiControllerTest extends TestCase
private $request;
private $msg;
- protected function setUp()
+ protected function setUp(): void
{
$this->user = 'tom';
$this->appName = 'news';
@@ -71,7 +71,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testIndex()
+ public function testIndex()
{
$item = new Item();
$item->setId(5);
@@ -102,7 +102,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testIndexDefaultBatchSize()
+ public function testIndexDefaultBatchSize()
{
$item = new Item();
$item->setId(5);
@@ -133,7 +133,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUpdated()
+ public function testUpdated()
{
$item = new Item();
$item->setId(5);
@@ -162,7 +162,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testRead()
+ public function testRead()
{
$this->itemService->expects($this->once())
->method('read')
@@ -176,7 +176,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testReadDoesNotExist()
+ public function testReadDoesNotExist()
{
$this->itemService->expects($this->once())
->method('read')
@@ -194,7 +194,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnread()
+ public function testUnread()
{
$this->itemService->expects($this->once())
->method('read')
@@ -208,7 +208,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnreadDoesNotExist()
+ public function testUnreadDoesNotExist()
{
$this->itemService->expects($this->once())
->method('read')
@@ -226,7 +226,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testStar()
+ public function testStar()
{
$this->itemService->expects($this->once())
->method('star')
@@ -241,7 +241,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testStarDoesNotExist()
+ public function testStarDoesNotExist()
{
$this->itemService->expects($this->once())
->method('star')
@@ -259,7 +259,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnstar()
+ public function testUnstar()
{
$this->itemService->expects($this->once())
->method('star')
@@ -274,7 +274,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnstarDoesNotExist()
+ public function testUnstarDoesNotExist()
{
$this->itemService->expects($this->once())
->method('star')
@@ -292,7 +292,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testReadAll()
+ public function testReadAll()
{
$this->itemService->expects($this->once())
->method('readAll')
@@ -306,7 +306,7 @@ class ItemApiControllerTest extends TestCase
- public function testReadMultiple()
+ public function testReadMultiple()
{
$this->itemService->expects($this->at(0))
->method('read')
@@ -326,7 +326,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testReadMultipleDoesntCareAboutException()
+ public function testReadMultipleDoesntCareAboutException()
{
$this->itemService->expects($this->at(0))
->method('read')
@@ -342,7 +342,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnreadMultiple()
+ public function testUnreadMultiple()
{
$this->itemService->expects($this->at(0))
->method('read')
@@ -362,7 +362,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testStarMultiple()
+ public function testStarMultiple()
{
$ids = [
[
@@ -395,7 +395,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testStarMultipleDoesntCareAboutException()
+ public function testStarMultipleDoesntCareAboutException()
{
$ids = [
[
@@ -423,7 +423,7 @@ class ItemApiControllerTest extends TestCase
}
- public function testUnstarMultiple()
+ public function testUnstarMultiple()
{
$ids = [
[
diff --git a/tests/Unit/Controller/ItemControllerTest.php b/tests/Unit/Controller/ItemControllerTest.php
index b24d74148..9dbcf15ce 100644
--- a/tests/Unit/Controller/ItemControllerTest.php
+++ b/tests/Unit/Controller/ItemControllerTest.php
@@ -43,7 +43,7 @@ class ItemControllerTest extends TestCase
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
$this->appName = 'news';
$this->user = 'jackob';
@@ -96,7 +96,7 @@ class ItemControllerTest extends TestCase
}
- public function testReadMultiple()
+ public function testReadMultiple()
{
$this->itemService->expects($this->at(0))
->method('read')
@@ -116,7 +116,7 @@ class ItemControllerTest extends TestCase
}
- public function testReadMultipleDontStopOnException()
+ public function testReadMultipleDontStopOnException()
{
$this->itemService->expects($this->at(0))
->method('read')
diff --git a/tests/Unit/Controller/JSONHttpErrorTest.php b/tests/Unit/Controller/JSONHttpErrorTest.php
index bf043bf54..c02b60c9e 100644
--- a/tests/Unit/Controller/JSONHttpErrorTest.php
+++ b/tests/Unit/Controller/JSONHttpErrorTest.php
@@ -26,7 +26,7 @@ class JSONHttpErrorTest extends TestCase
{
- public function testError()
+ public function testError()
{
$ex = new \Exception('hi');
$test = new Test();
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php
index ce7a3e73d..69fed0d77 100644
--- a/tests/Unit/Controller/PageControllerTest.php
+++ b/tests/Unit/Controller/PageControllerTest.php
@@ -13,7 +13,7 @@
namespace OCA\News\Tests\Unit\Controller;
-use OCA\News\Config\Config;
+use OC\L10N\L10N;
use OCA\News\Controller\PageController;
use \OCA\News\Db\FeedType;
use OCA\News\Explore\RecommendedSites;
@@ -28,26 +28,51 @@ use PHPUnit\Framework\TestCase;
class PageControllerTest extends TestCase
{
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IConfig
+ */
private $settings;
- private $appName;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IRequest
+ */
private $request;
+
+ /**
+ * @var PageController
+ */
private $controller;
- private $user;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|L10N
+ */
private $l10n;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|IURLGenerator
+ */
private $urlGenerator;
- private $appConfig;
+
+ /**
+ * @var array
+ */
private $configData;
- private $config;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|RecommendedSites
+ */
private $recommended;
+
+ /**
+ * @var \PHPUnit\Framework\MockObject\MockObject|StatusService
+ */
private $status;
/**
* Gets run before each test
*/
- public function setUp()
+ public function setUp(): void
{
- $this->appName = 'news';
- $this->user = 'becka';
$this->configData = [
'name' => 'AppTest',
'id' => 'apptest',
@@ -70,12 +95,6 @@ class PageControllerTest extends TestCase
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
- $this->appConfig = $this->getMockBuilder(Config::class)
- ->disableOriginalConstructor()
- ->getMock();
- $this->config = $this->getMockBuilder(Config::class)
- ->disableOriginalConstructor()
- ->getMock();
$this->recommended = $this->getMockBuilder(RecommendedSites::class)
->disableOriginalConstructor()
->getMock();
@@ -83,10 +102,14 @@ class PageControllerTest extends TestCase
->disableOriginalConstructor()
->getMock();
$this->controller = new PageController(
- $this->appName, $this->request,
- $this->settings, $this->urlGenerator, $this->config,
- $this->l10n, $this->recommended, $this->status,
- $this->user
+ 'news',
+ $this->request,
+ $this->settings,
+ $this->urlGenerator,
+ $this->l10n,
+ $this->recommended,
+ $this->status,
+ 'becka'
);
}
@@ -95,15 +118,7 @@ class PageControllerTest extends TestCase
{
$this->status->expects($this->once())
->method('getStatus')
- ->will(
- $this->returnValue(
- [
- 'warnings' => [
- 'improperlyConfiguredCron' => false
- ]
- ]
- )
- );
+ ->will($this->returnValue(['warnings' => ['improperlyConfiguredCron' => false]]));