diff options
author | Georg Ehrke <developer@georgehrke.com> | 2017-11-11 02:02:17 +0100 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2017-11-11 11:28:34 +0100 |
commit | a87d9860418948a72fbe3d29a2cc5d589be147ec (patch) | |
tree | c4613956e0e60086f0f95f723f327d436ca51ebf /apps/dav/tests | |
parent | 4d5ed1372a8a22f17b5da6673fcf151aab8ce801 (diff) | |
download | nextcloud-server-a87d9860418948a72fbe3d29a2cc5d589be147ec.tar.gz nextcloud-server-a87d9860418948a72fbe3d29a2cc5d589be147ec.zip |
create a user's birthday calendar right after they requested it
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/tests')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php index 6e7965ea61b..44bf9237b2f 100644 --- a/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php +++ b/apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php @@ -22,6 +22,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\BirthdayCalendar; use OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin; +use OCA\DAV\CalDAV\BirthdayService; use OCA\DAV\CalDAV\Calendar; use OCA\DAV\CalDAV\CalendarHome; use OCP\IConfig; @@ -35,6 +36,9 @@ class EnablePluginTest extends TestCase { /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; + /** @var BirthdayService |\PHPUnit_Framework_MockObject_MockObject */ + protected $birthdayService; + /** @var \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin $plugin */ protected $plugin; @@ -51,8 +55,9 @@ class EnablePluginTest extends TestCase { $this->server->xml = $this->createMock(\Sabre\DAV\Xml\Service::class); $this->config = $this->createMock(IConfig::class); + $this->birthdayService = $this->createMock(BirthdayService::class); - $this->plugin = new EnablePlugin($this->config); + $this->plugin = new EnablePlugin($this->config, $this->birthdayService); $this->plugin->initialize($this->server); $this->request = $this->createMock(\Sabre\HTTP\RequestInterface::class); @@ -70,7 +75,7 @@ class EnablePluginTest extends TestCase { public function testInitialize() { $server = $this->createMock(\Sabre\DAV\Server::class); - $plugin = new EnablePlugin($this->config); + $plugin = new EnablePlugin($this->config, $this->birthdayService); $server->expects($this->at(0)) ->method('on') @@ -93,6 +98,9 @@ class EnablePluginTest extends TestCase { $this->config->expects($this->never()) ->method('setUserValue'); + $this->birthdayService->expects($this->never()) + ->method('syncUser'); + $this->plugin->httpPost($this->request, $this->response); } @@ -124,6 +132,9 @@ class EnablePluginTest extends TestCase { $this->config->expects($this->never()) ->method('setUserValue'); + $this->birthdayService->expects($this->never()) + ->method('syncUser'); + $this->plugin->httpPost($this->request, $this->response); } @@ -160,6 +171,10 @@ class EnablePluginTest extends TestCase { ->method('setUserValue') ->with('BlaBlub', 'dav', 'generateBirthdayCalendar', 'yes'); + $this->birthdayService->expects($this->once()) + ->method('syncUser') + ->with('BlaBlub'); + $this->server->httpResponse->expects($this->once()) ->method('setStatus') ->with(204); |