diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4878e283..26599708 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -34,25 +34,26 @@ class PageController extends Controller { protected $appName; - // /** @var IInitialStateService */ - // private $initialStateService; - - /** @var IFactory */ - private $languageFactory; /** @var IConfig */ private $config; - public function __construct(string $AppName, + /** @var IInitialStateService */ + private $initialStateService; + + /** @var IFactory */ + private $languageFactory; + + public function __construct(string $appName, IRequest $request, IConfig $config, IInitialStateService $initialStateService, IFactory $languageFactory) { - parent::__construct($AppName, $request); + parent::__construct($appName, $request); - $this->appName = $AppName; + $this->appName = $appName; + $this->config = $config; $this->initialStateService = $initialStateService; $this->languageFactory = $languageFactory; - $this->config = $config; } /** diff --git a/tests/unit/Controller/PageControllerTest.php b/tests/unit/Controller/PageControllerTest.php index 3f3c72b3..1673269e 100644 --- a/tests/unit/Controller/PageControllerTest.php +++ b/tests/unit/Controller/PageControllerTest.php @@ -26,7 +26,7 @@ namespace OCA\Contacts\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; -// use OCP\IInitialStateService; +use OCP\IInitialStateService; use OCP\IRequest; use OCP\L10N\IFactory; use ChristophWurst\Nextcloud\Testing\TestCase; @@ -39,11 +39,12 @@ class PageControllerTest extends TestCase { /** @var IRequest|MockObject */ private $request; - // /** @var IInitialStateService|MockObject */ - // private $initialStateService; + /** @var IInitialStateService|MockObject */ + private $initialStateService; /** @var IFactory|MockObject */ private $languageFactory; + /** @var IConfig|MockObject*/ private $config; @@ -52,15 +53,15 @@ class PageControllerTest extends TestCase { parent::setUp(); $this->request = $this->createMock(IRequest::class); - // $this->initialStateService = $this->createMock(IInitialStateService::class); + $this->initialStateService = $this->createMock(IInitialStateService::class); $this->languageFactory = $this->createMock(IFactory::class); $this->config = $this->createMock(IConfig::class); $this->controller = new PageController( 'contacts', $this->request, - // $this->initialStateService, $this->config, + $this->initialStateService, $this->languageFactory );