BirthdayServiceTest.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\DAV\Tests\unit\CardDAV;
  28. use OCA\DAV\CalDAV\BirthdayService;
  29. use OCA\DAV\CalDAV\CalDavBackend;
  30. use OCA\DAV\CardDAV\CardDavBackend;
  31. use OCA\DAV\DAV\GroupPrincipalBackend;
  32. use OCP\IConfig;
  33. use OCP\IDBConnection;
  34. use OCP\IL10N;
  35. use Sabre\VObject\Component\VCalendar;
  36. use Sabre\VObject\Reader;
  37. use Test\TestCase;
  38. class BirthdayServiceTest extends TestCase {
  39. /** @var BirthdayService */
  40. private $service;
  41. /** @var CalDavBackend | \PHPUnit\Framework\MockObject\MockObject */
  42. private $calDav;
  43. /** @var CardDavBackend | \PHPUnit\Framework\MockObject\MockObject */
  44. private $cardDav;
  45. /** @var GroupPrincipalBackend | \PHPUnit\Framework\MockObject\MockObject */
  46. private $groupPrincipalBackend;
  47. /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
  48. private $config;
  49. /** @var IDBConnection | \PHPUnit\Framework\MockObject\MockObject */
  50. private $dbConnection;
  51. /** @var IL10N | \PHPUnit\Framework\MockObject\MockObject */
  52. private $l10n;
  53. protected function setUp(): void {
  54. parent::setUp();
  55. $this->calDav = $this->createMock(CalDavBackend::class);
  56. $this->cardDav = $this->createMock(CardDavBackend::class);
  57. $this->groupPrincipalBackend = $this->createMock(GroupPrincipalBackend::class);
  58. $this->config = $this->createMock(IConfig::class);
  59. $this->dbConnection = $this->createMock(IDBConnection::class);
  60. $this->l10n = $this->createMock(IL10N::class);
  61. $this->l10n->expects($this->any())
  62. ->method('t')
  63. ->willReturnCallback(function ($string, $args) {
  64. return vsprintf($string, $args);
  65. });
  66. $this->service = new BirthdayService($this->calDav,$this->cardDav,
  67. $this->groupPrincipalBackend, $this->config,
  68. $this->dbConnection, $this->l10n);
  69. }
  70. /**
  71. * @dataProvider providesVCards
  72. * @param string $expectedSummary
  73. * @param string $expectedDTStart
  74. * @param string $expectedFieldType
  75. * @param string $expectedUnknownYear
  76. * @param string $expectedOriginalYear
  77. * @param string | null $data
  78. */
  79. public function testBuildBirthdayFromContact($expectedSummary, $expectedDTStart, $expectedFieldType, $expectedUnknownYear, $expectedOriginalYear, $data, $fieldType, $prefix, $supports4Bytes) {
  80. $this->dbConnection->method('supports4ByteText')->willReturn($supports4Bytes);
  81. $cal = $this->service->buildDateFromContact($data, $fieldType, $prefix);
  82. if ($expectedSummary === null) {
  83. $this->assertNull($cal);
  84. } else {
  85. $this->assertInstanceOf('Sabre\VObject\Component\VCalendar', $cal);
  86. $this->assertEquals('-//IDN nextcloud.com//Birthday calendar//EN', $cal->PRODID->getValue());
  87. $this->assertTrue(isset($cal->VEVENT));
  88. $this->assertEquals('FREQ=YEARLY', $cal->VEVENT->RRULE->getValue());
  89. $this->assertEquals($expectedSummary, $cal->VEVENT->SUMMARY->getValue());
  90. $this->assertEquals($expectedDTStart, $cal->VEVENT->DTSTART->getValue());
  91. $this->assertEquals($expectedFieldType, $cal->VEVENT->{'X-NEXTCLOUD-BC-FIELD-TYPE'}->getValue());
  92. $this->assertEquals($expectedUnknownYear, $cal->VEVENT->{'X-NEXTCLOUD-BC-UNKNOWN-YEAR'}->getValue());
  93. if ($expectedOriginalYear) {
  94. $this->assertEquals($expectedOriginalYear, $cal->VEVENT->{'X-NEXTCLOUD-BC-YEAR'}->getValue());
  95. }
  96. $this->assertEquals('TRANSPARENT', $cal->VEVENT->TRANSP->getValue());
  97. }
  98. }
  99. public function testOnCardDeleteGloballyDisabled() {
  100. $this->config->expects($this->once())
  101. ->method('getAppValue')
  102. ->with('dav', 'generateBirthdayCalendar', 'yes')
  103. ->willReturn('no');
  104. $this->cardDav->expects($this->never())->method('getAddressBookById');
  105. $this->service->onCardDeleted(666, 'gump.vcf');
  106. }
  107. public function testOnCardDeleteUserDisabled() {
  108. $this->config->expects($this->once())
  109. ->method('getAppValue')
  110. ->with('dav', 'generateBirthdayCalendar', 'yes')
  111. ->willReturn('yes');
  112. $this->config->expects($this->once())
  113. ->method('getUserValue')
  114. ->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
  115. ->willReturn('no');
  116. $this->cardDav->expects($this->once())->method('getAddressBookById')
  117. ->with(666)
  118. ->willReturn([
  119. 'principaluri' => 'principals/users/user01',
  120. 'uri' => 'default'
  121. ]);
  122. $this->cardDav->expects($this->once())->method('getShares')->willReturn([]);
  123. $this->calDav->expects($this->never())->method('getCalendarByUri');
  124. $this->calDav->expects($this->never())->method('deleteCalendarObject');
  125. $this->service->onCardDeleted(666, 'gump.vcf');
  126. }
  127. public function testOnCardDeleted() {
  128. $this->config->expects($this->once())
  129. ->method('getAppValue')
  130. ->with('dav', 'generateBirthdayCalendar', 'yes')
  131. ->willReturn('yes');
  132. $this->config->expects($this->once())
  133. ->method('getUserValue')
  134. ->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
  135. ->willReturn('yes');
  136. $this->cardDav->expects($this->once())->method('getAddressBookById')
  137. ->with(666)
  138. ->willReturn([
  139. 'principaluri' => 'principals/users/user01',
  140. 'uri' => 'default'
  141. ]);
  142. $this->calDav->expects($this->once())->method('getCalendarByUri')
  143. ->with('principals/users/user01', 'contact_birthdays')
  144. ->willReturn([
  145. 'id' => 1234
  146. ]);
  147. $this->calDav->expects($this->at(1))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf.ics');
  148. $this->calDav->expects($this->at(2))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf-death.ics');
  149. $this->calDav->expects($this->at(3))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf-anniversary.ics');
  150. $this->cardDav->expects($this->once())->method('getShares')->willReturn([]);
  151. $this->service->onCardDeleted(666, 'gump.vcf');
  152. }
  153. public function testOnCardChangedGloballyDisabled() {
  154. $this->config->expects($this->once())
  155. ->method('getAppValue')
  156. ->with('dav', 'generateBirthdayCalendar', 'yes')
  157. ->willReturn('no');
  158. $this->cardDav->expects($this->never())->method('getAddressBookById');
  159. $service = $this->getMockBuilder(BirthdayService::class)
  160. ->setMethods(['buildDateFromContact', 'birthdayEvenChanged'])
  161. ->setConstructorArgs([$this->calDav, $this->cardDav, $this->groupPrincipalBackend, $this->config, $this->dbConnection, $this->l10n])
  162. ->getMock();
  163. $service->onCardChanged(666, 'gump.vcf', '');
  164. }
  165. public function testOnCardChangedUserDisabled() {
  166. $this->config->expects($this->once())
  167. ->method('getAppValue')
  168. ->with('dav', 'generateBirthdayCalendar', 'yes')
  169. ->willReturn('yes');
  170. $this->config->expects($this->once())
  171. ->method('getUserValue')
  172. ->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
  173. ->willReturn('no');
  174. $this->cardDav->expects($this->once())->method('getAddressBookById')
  175. ->with(666)
  176. ->willReturn([
  177. 'principaluri' => 'principals/users/user01',
  178. 'uri' => 'default'
  179. ]);
  180. $this->cardDav->expects($this->once())->method('getShares')->willReturn([]);
  181. $this->calDav->expects($this->never())->method('getCalendarByUri');
  182. /** @var BirthdayService | \PHPUnit\Framework\MockObject\MockObject $service */
  183. $service = $this->getMockBuilder(BirthdayService::class)
  184. ->setMethods(['buildDateFromContact', 'birthdayEvenChanged'])
  185. ->setConstructorArgs([$this->calDav, $this->cardDav, $this->groupPrincipalBackend, $this->config, $this->dbConnection, $this->l10n])
  186. ->getMock();
  187. $service->onCardChanged(666, 'gump.vcf', '');
  188. }
  189. /**
  190. * @dataProvider providesCardChanges
  191. */
  192. public function testOnCardChanged($expectedOp) {
  193. $this->config->expects($this->once())
  194. ->method('getAppValue')
  195. ->with('dav', 'generateBirthdayCalendar', 'yes')
  196. ->willReturn('yes');
  197. $this->config->expects($this->once())
  198. ->method('getUserValue')
  199. ->with('user01', 'dav', 'generateBirthdayCalendar', 'yes')
  200. ->willReturn('yes');
  201. $this->cardDav->expects($this->once())->method('getAddressBookById')
  202. ->with(666)
  203. ->willReturn([
  204. 'principaluri' => 'principals/users/user01',
  205. 'uri' => 'default'
  206. ]);
  207. $this->calDav->expects($this->once())->method('getCalendarByUri')
  208. ->with('principals/users/user01', 'contact_birthdays')
  209. ->willReturn([
  210. 'id' => 1234
  211. ]);
  212. $this->cardDav->expects($this->once())->method('getShares')->willReturn([]);
  213. /** @var BirthdayService | \PHPUnit\Framework\MockObject\MockObject $service */
  214. $service = $this->getMockBuilder(BirthdayService::class)
  215. ->setMethods(['buildDateFromContact', 'birthdayEvenChanged'])
  216. ->setConstructorArgs([$this->calDav, $this->cardDav, $this->groupPrincipalBackend, $this->config, $this->dbConnection, $this->l10n])
  217. ->getMock();
  218. if ($expectedOp === 'delete') {
  219. $this->calDav->expects($this->exactly(3))->method('getCalendarObject')->willReturn('');
  220. $service->expects($this->exactly(3))->method('buildDateFromContact')->willReturn(null);
  221. $this->calDav->expects($this->exactly(3))->method('deleteCalendarObject')->withConsecutive(
  222. [1234, 'default-gump.vcf.ics'],
  223. [1234, 'default-gump.vcf-death.ics'],
  224. [1234, 'default-gump.vcf-anniversary.ics']
  225. );
  226. }
  227. if ($expectedOp === 'create') {
  228. $vCal = new VCalendar();
  229. $vCal->PRODID = '-//Nextcloud testing//mocked object//';
  230. $service->expects($this->exactly(3))->method('buildDateFromContact')->willReturn($vCal);
  231. $this->calDav->expects($this->exactly(3))->method('createCalendarObject')->withConsecutive(
  232. [1234, 'default-gump.vcf.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"],
  233. [1234, 'default-gump.vcf-death.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"],
  234. [1234, 'default-gump.vcf-anniversary.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"]
  235. );
  236. }
  237. if ($expectedOp === 'update') {
  238. $vCal = new VCalendar();
  239. $vCal->PRODID = '-//Nextcloud testing//mocked object//';
  240. $service->expects($this->exactly(3))->method('buildDateFromContact')->willReturn($vCal);
  241. $service->expects($this->exactly(3))->method('birthdayEvenChanged')->willReturn(true);
  242. $this->calDav->expects($this->exactly(3))->method('getCalendarObject')->willReturn(['calendardata' => '']);
  243. $this->calDav->expects($this->exactly(3))->method('updateCalendarObject')->withConsecutive(
  244. [1234, 'default-gump.vcf.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"],
  245. [1234, 'default-gump.vcf-death.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"],
  246. [1234, 'default-gump.vcf-anniversary.ics', "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nPRODID:-//Nextcloud testing//mocked object//\r\nEND:VCALENDAR\r\n"]
  247. );
  248. }
  249. $service->onCardChanged(666, 'gump.vcf', '');
  250. }
  251. /**
  252. * @dataProvider providesBirthday
  253. * @param $expected
  254. * @param $old
  255. * @param $new
  256. */
  257. public function testBirthdayEvenChanged($expected, $old, $new) {
  258. $new = Reader::read($new);
  259. $this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
  260. }
  261. public function testGetAllAffectedPrincipals() {
  262. $this->cardDav->expects($this->once())->method('getShares')->willReturn([
  263. [
  264. '{http://owncloud.org/ns}group-share' => false,
  265. '{http://owncloud.org/ns}principal' => 'principals/users/user01'
  266. ],
  267. [
  268. '{http://owncloud.org/ns}group-share' => false,
  269. '{http://owncloud.org/ns}principal' => 'principals/users/user01'
  270. ],
  271. [
  272. '{http://owncloud.org/ns}group-share' => false,
  273. '{http://owncloud.org/ns}principal' => 'principals/users/user02'
  274. ],
  275. [
  276. '{http://owncloud.org/ns}group-share' => true,
  277. '{http://owncloud.org/ns}principal' => 'principals/groups/users'
  278. ],
  279. ]);
  280. $this->groupPrincipalBackend->expects($this->once())->method('getGroupMemberSet')
  281. ->willReturn([
  282. [
  283. 'uri' => 'principals/users/user01',
  284. ],
  285. [
  286. 'uri' => 'principals/users/user02',
  287. ],
  288. [
  289. 'uri' => 'principals/users/user03',
  290. ],
  291. ]);
  292. $users = $this->invokePrivate($this->service, 'getAllAffectedPrincipals', [6666]);
  293. $this->assertEquals([
  294. 'principals/users/user01',
  295. 'principals/users/user02',
  296. 'principals/users/user03'
  297. ], $users);
  298. }
  299. public function testBirthdayCalendarHasComponentEvent() {
  300. $this->calDav->expects($this->once())
  301. ->method('createCalendar')
  302. ->with('principal001', 'contact_birthdays', [
  303. '{DAV:}displayname' => 'Contact birthdays',
  304. '{http://apple.com/ns/ical/}calendar-color' => '#E9D859',
  305. 'components' => 'VEVENT',
  306. ]);
  307. $this->service->ensureCalendarExists('principal001');
  308. }
  309. public function testResetForUser() {
  310. $this->calDav->expects($this->at(0))
  311. ->method('getCalendarByUri')
  312. ->with('principals/users/user123', 'contact_birthdays')
  313. ->willReturn(['id' => 42]);
  314. $this->calDav->expects($this->at(1))
  315. ->method('getCalendarObjects')
  316. ->with(42, 0)
  317. ->willReturn([['uri' => '1.ics'], ['uri' => '2.ics'], ['uri' => '3.ics']]);
  318. $this->calDav->expects($this->at(2))
  319. ->method('deleteCalendarObject')
  320. ->with(42, '1.ics', 0);
  321. $this->calDav->expects($this->at(3))
  322. ->method('deleteCalendarObject')
  323. ->with(42, '2.ics', 0);
  324. $this->calDav->expects($this->at(4))
  325. ->method('deleteCalendarObject')
  326. ->with(42, '3.ics', 0);
  327. $this->service->resetForUser('user123');
  328. }
  329. public function providesBirthday() {
  330. return [
  331. [true,
  332. '',
  333. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
  334. [false,
  335. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
  336. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
  337. [true,
  338. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:4567's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
  339. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"],
  340. [true,
  341. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000101\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n",
  342. "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nUID:12345\r\nDTSTAMP:20160218T133704Z\r\nDTSTART;VALUE=DATE:19000102\r\nDTEND;VALUE=DATE:19000102\r\nRRULE:FREQ=YEARLY\r\nSUMMARY:12345's Birthday (1900)\r\nTRANSP:TRANSPARENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"]
  343. ];
  344. }
  345. public function providesCardChanges() {
  346. return[
  347. ['delete'],
  348. ['create'],
  349. ['update']
  350. ];
  351. }
  352. public function providesVCards() {
  353. return [
  354. // $expectedSummary, $expectedDTStart, $expectedFieldType, $expectedUnknownYear, $expectedOriginalYear, $data, $fieldType, $prefix, $supports4Byte
  355. [null, null, null, null, null, 'yasfewf', '', '', true],
  356. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nEND:VCARD\r\n", 'BDAY', '', true],
  357. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:\r\nEND:VCARD\r\n", 'BDAY', '', true],
  358. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:someday\r\nEND:VCARD\r\n", 'BDAY', '', true],
  359. ['🎂 12345 (1900)', '19700101', 'BDAY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:19000101\r\nEND:VCARD\r\n", 'BDAY', '', true],
  360. ['🎂 12345 (1900)', '19701231', 'BDAY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:19001231\r\nEND:VCARD\r\n", 'BDAY', '', true],
  361. ['Death of 12345 (1900)', '19701231', 'DEATHDATE', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nDEATHDATE:19001231\r\nEND:VCARD\r\n", 'DEATHDATE', '-death', true],
  362. ['Death of 12345 (1900)', '19701231', 'DEATHDATE', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nDEATHDATE:19001231\r\nEND:VCARD\r\n", 'DEATHDATE', '-death', false],
  363. ['💍 12345 (1900)', '19701231', 'ANNIVERSARY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nANNIVERSARY:19001231\r\nEND:VCARD\r\n", 'ANNIVERSARY', '-anniversary', true],
  364. ['12345 (⚭1900)', '19701231', 'ANNIVERSARY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nANNIVERSARY:19001231\r\nEND:VCARD\r\n", 'ANNIVERSARY', '-anniversary', false],
  365. ['🎂 12345', '19701231', 'BDAY', '1', null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:--1231\r\nEND:VCARD\r\n", 'BDAY', '', true],
  366. ['🎂 12345', '19701231', 'BDAY', '1', null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY;X-APPLE-OMIT-YEAR=1604:16041231\r\nEND:VCARD\r\n", 'BDAY', '', true],
  367. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:;VALUE=text:circa 1800\r\nEND:VCARD\r\n", 'BDAY', '', true],
  368. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nN:12345;;;;\r\nBDAY:20031231\r\nEND:VCARD\r\n", 'BDAY', '', true],
  369. ['🎂 12345 (900)', '19701231', 'BDAY', '0', '900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:09001231\r\nEND:VCARD\r\n", 'BDAY', '', true],
  370. ['12345 (*1900)', '19700101', 'BDAY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:19000101\r\nEND:VCARD\r\n", 'BDAY', '', false],
  371. ['12345 (*1900)', '19701231', 'BDAY', '0', '1900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:19001231\r\nEND:VCARD\r\n", 'BDAY', '', false],
  372. ['12345 *', '19701231', 'BDAY', '1', null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:--1231\r\nEND:VCARD\r\n", 'BDAY', '', false],
  373. ['12345 *', '19701231', 'BDAY', '1', null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY;X-APPLE-OMIT-YEAR=1604:16041231\r\nEND:VCARD\r\n", 'BDAY', '', false],
  374. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:;VALUE=text:circa 1800\r\nEND:VCARD\r\n", 'BDAY', '', false],
  375. [null, null, null, null, null, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nN:12345;;;;\r\nBDAY:20031231\r\nEND:VCARD\r\n", 'BDAY', '', false],
  376. ['12345 (*900)', '19701231', 'BDAY', '0', '900', "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:09001231\r\nEND:VCARD\r\n", 'BDAY', '', false],
  377. ];
  378. }
  379. }