From c05a0b9fa6c55e2c392bdca43c6563ecffc36479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 21 Feb 2018 10:18:38 +0100 Subject: [PATCH] Adding test for table schedulingobjects and fixing postgres LOB (cherry picked from commit afd4ebf0404e8bcd7cba0bec2dce177e97632f8a) Signed-off-by: Jan Losinski --- apps/dav/lib/CalDAV/CalDavBackend.php | 2 +- .../tests/unit/CalDAV/CalDavBackendTest.php | 80 ++++++++++++++++++- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index de46dfeb24..df10b62fc5 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1986,7 +1986,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $query->insert('schedulingobjects') ->values([ 'principaluri' => $query->createNamedParameter($principalUri), - 'calendardata' => $query->createNamedParameter($objectData), + 'calendardata' => $query->createNamedParameter($objectData, IQueryBuilder::PARAM_LOB), 'uri' => $query->createNamedParameter($objectUri), 'lastmodified' => $query->createNamedParameter(time()), 'etag' => $query->createNamedParameter(md5($objectData)), diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index fd04824046..26439df4a0 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -562,8 +562,84 @@ EOD; $this->assertCount(0, $subscriptions); } - public function testScheduling() { - $this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', ''); + public function providesSchedulingData() { + $data =<<'\;'~\n o_)\; \; )))(((` ~--- + ~ `:: \\ %%~~)(v\;(`('~\n \; ''''```` + `: `:::|\\\,__\,%% )\;`'\; ~\n | _ + ) / `:|`----' `-'\n ______/\\/~ | + / /\n /~\;\;.____/\;\;' / ___--\ + ,-( `\;\;\;/\n / // _\;______\;'------~~~~~ /\;\;/\\ /\n + // | | / \; \\\;\;\,\\\n (<_ | \; + /'\,/-----' _>\n \\_| ||_ + //~\;~~~~~~~~~\n `\\_| (\,~~ -Tua Xiong\n + \\~\\\n + ~~\n\n +SEQUENCE:1 +X-MOZ-GENERATION:1 +END:VEVENT +END:VCALENDAR +EOS; + + return [ + 'no data' => [''], + 'failing on postgres' => [$data] + ]; + } + + /** + * @dataProvider providesSchedulingData + * @param $objectData + */ + public function testScheduling($objectData) { + $this->backend->createSchedulingObject(self::UNIT_TEST_USER, 'Sample Schedule', $objectData); $sos = $this->backend->getSchedulingObjects(self::UNIT_TEST_USER); $this->assertCount(1, $sos);