Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests for CalendarManager #7458

Merged
merged 1 commit into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/dav/lib/CalDAV/CalendarManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace OCA\DAV\CalDAV;

use OCP\Calendar\IManager;
use OCP\IConfig;
use OCP\IL10N;

class CalendarManager {
Expand All @@ -34,15 +35,20 @@ class CalendarManager {
/** @var IL10N */
private $l10n;

/** @var IConfig */
private $config;

/**
* CalendarManager constructor.
*
* @param CalDavBackend $backend
* @param IL10N $l10n
* @param IConfig $config
*/
public function __construct(CalDavBackend $backend, IL10N $l10n) {
public function __construct(CalDavBackend $backend, IL10N $l10n, IConfig $config) {
$this->backend = $backend;
$this->l10n = $l10n;
$this->config = $config;
}

/**
Expand All @@ -60,7 +66,7 @@ public function setupCalendarProvider(IManager $cm, $userId) {
*/
private function register(IManager $cm, array $calendars) {
foreach($calendars as $calendarInfo) {
$calendar = new Calendar($this->backend, $calendarInfo, $this->l10n);
$calendar = new Calendar($this->backend, $calendarInfo, $this->l10n, $this->config);
$cm->registerCalendar(new CalendarImpl(
$calendar,
$calendarInfo,
Expand Down
7 changes: 6 additions & 1 deletion apps/dav/tests/unit/CalDAV/CalendarManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCA\DAV\CalDAV\CalendarImpl;
use OCA\DAV\CalDAV\CalendarManager;
use OCP\Calendar\IManager;
use OCP\IConfig;
use OCP\IL10N;

class CalendarManagerTest extends \Test\TestCase {
Expand All @@ -38,15 +39,19 @@ class CalendarManagerTest extends \Test\TestCase {
/** @var IL10N | \PHPUnit_Framework_MockObject_MockObject */
private $l10n;

/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
private $config;

/** @var CalendarManager */
private $manager;

protected function setUp() {
parent::setUp();
$this->backend = $this->createMock(CalDavBackend::class);
$this->l10n = $this->createMock(IL10N::class);
$this->config = $this->createMock(IConfig::class);
$this->manager = new CalendarManager($this->backend,
$this->l10n);
$this->l10n, $this->config);
}

public function testSetupCalendarProvider() {
Expand Down