diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-08-28 09:34:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-28 09:34:38 +0200 |
commit | e99fa92456e49aa8a2024879473515c92260c8e8 (patch) | |
tree | c98d182b596fb6850683bd8cd3c66178aaf0c0d8 /apps/dav/tests/unit | |
parent | 7b12b4b43f06cb37800960bdaab3075a3869f029 (diff) | |
parent | cc37c39ede9d7e29c1b71acc7a67e6bca40aa8af (diff) | |
download | nextcloud-server-e99fa92456e49aa8a2024879473515c92260c8e8.tar.gz nextcloud-server-e99fa92456e49aa8a2024879473515c92260c8e8.zip |
Merge pull request #16615 from nextcloud/feature/16518/rooms_resources_should_respond
Make rooms / resources automatically reply to invites
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php index 243077063a0..ff6c0837c7a 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php @@ -26,6 +26,8 @@ namespace OCA\DAV\Tests\unit\CalDAV\Schedule; use OCA\DAV\CalDAV\Schedule\Plugin; use Sabre\DAV\Server; use Sabre\DAV\Xml\Property\Href; +use Sabre\VObject\Parameter; +use Sabre\VObject\Property\ICalendar\CalAddress; use Test\TestCase; class PluginTest extends TestCase { @@ -82,4 +84,43 @@ class PluginTest extends TestCase { $result = $this->invokePrivate($this->plugin, 'getAddressesForPrincipal', ['MyPrincipal']); $this->assertSame([], $result); } + + public function testStripOffMailTo() { + $this->assertEquals('test@example.com', $this->invokePrivate($this->plugin, 'stripOffMailTo', ['test@example.com'])); + $this->assertEquals('test@example.com', $this->invokePrivate($this->plugin, 'stripOffMailTo', ['mailto:test@example.com'])); + } + + public function testGetAttendeeRSVP() { + $property1 = $this->createMock(CalAddress::class); + $parameter1 = $this->createMock(Parameter::class); + $property1->expects($this->once()) + ->method('offsetGet') + ->with('RSVP') + ->willReturn($parameter1); + $parameter1->expects($this->once()) + ->method('getValue') + ->with() + ->willReturn('TRUE'); + + $property2 = $this->createMock(CalAddress::class); + $parameter2 = $this->createMock(Parameter::class); + $property2->expects($this->once()) + ->method('offsetGet') + ->with('RSVP') + ->willReturn($parameter2); + $parameter2->expects($this->once()) + ->method('getValue') + ->with() + ->willReturn('FALSE'); + + $property3 = $this->createMock(CalAddress::class); + $property3->expects($this->once()) + ->method('offsetGet') + ->with('RSVP') + ->willReturn(null); + + $this->assertTrue($this->invokePrivate($this->plugin, 'getAttendeeRSVP', [$property1])); + $this->assertFalse($this->invokePrivate($this->plugin, 'getAttendeeRSVP', [$property2])); + $this->assertFalse($this->invokePrivate($this->plugin, 'getAttendeeRSVP', [$property3])); + } } |