diff options
Diffstat (limited to 'apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php')
-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])); + } } |