signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $response = $this->call('PROPFIND', "/dav/calendars/{$user->email}/birthdays"); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $response->assertSee("/dav/calendars/{$user->email}/birthdays/", false); $specialDate->refresh(); $response->assertSee("/dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics", false); } public function test_caldav_birthdays_propfind_with_props() { $user = $this->signin(); $response = $this->call('PROPFIND', "/dav/calendars/{$user->email}/birthdays/", [], [], [], [ 'HTTP_DEPTH' => 0, ], ' ' ); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $response->assertSee(''. ''. "/dav/calendars/{$user->email}/birthdays/". ''. ''. 'Birthdays'. ''. 'HTTP/1.1 200 OK'. ''. ''. 'signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $specialDate->uuid = Str::uuid(); $specialDate->save(); $response = $this->call('PROPFIND', "/dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics"); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $response->assertSee("/dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics", false); } public function test_caldav_birthdays_getctag() { $user = $this->signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $specialDate->uuid = Str::uuid(); $specialDate->save(); $response = $this->call('PROPFIND', "/dav/calendars/{$user->email}/", [], [], [], [ 'HTTP_DEPTH' => '1', 'content-type' => 'application/xml; charset=utf-8', ], " " ); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $tokens = SyncToken::where([ 'account_id' => $user->account_id, 'user_id' => $user->id, 'name' => 'birthdays', ])->orderBy('created_at')->get(); $this->assertGreaterThan(0, $tokens->count()); $token = $tokens->last(); $response->assertSee('', false); $response->assertSee(''. "/dav/calendars/{$user->email}/birthdays/". ''. ''. "http://sabre.io/ns/sync/{$token->id}". "http://sabre.io/ns/sync/{$token->id}". "http://sabre.io/ns/sync/{$token->id}". ''. 'HTTP/1.1 200 OK'. ''. '', false); } public function test_caldav_birthdays_getctag_birthday() { $user = $this->signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $specialDate->uuid = Str::uuid(); $specialDate->save(); $response = $this->call('PROPFIND', "/dav/calendars/{$user->email}/birthdays/", [], [], [], [ 'HTTP_DEPTH' => '0', 'content-type' => 'application/xml; charset=utf-8', ], " " ); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $tokens = SyncToken::where([ 'account_id' => $user->account_id, 'user_id' => $user->id, 'name' => 'birthdays', ])->orderBy('created_at')->get(); $this->assertGreaterThan(0, $tokens->count()); $token = $tokens->last(); $response->assertSee('', false); $response->assertSee(''. "/dav/calendars/{$user->email}/birthdays/". ''. ''. "http://sabre.io/ns/sync/{$token->id}". "http://sabre.io/ns/sync/{$token->id}". "http://sabre.io/ns/sync/{$token->id}". ''. 'HTTP/1.1 200 OK'. ''. '', false); } public function test_caldav_birthdays_sync_collection_with_token() { Carbon::setTestNow(Carbon::create(2019, 1, 1, 9, 0, 0)); $user = $this->signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $specialDate->uuid = Str::uuid(); $specialDate->save(); Carbon::setTestNow(Carbon::create(2019, 1, 1, 8, 0, 0)); $token = factory(SyncToken::class)->create([ 'account_id' => $user->account_id, 'user_id' => $user->id, 'name' => 'birthdays', 'timestamp' => now(), ]); $response = $this->call('REPORT', "/dav/calendars/{$user->email}/birthdays/", [], [], [], [ 'content-type' => 'application/xml; charset=utf-8', ], " http://sabre.io/ns/sync/{$token->id} 1 " ); $response->assertStatus(207); $token = SyncToken::where([ 'account_id' => $user->account_id, 'user_id' => $user->id, 'name' => 'birthdays', ]) ->orderBy('created_at') ->get() ->last(); $response->assertSee(" /dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics "{$this->getEtag($specialDate)}" HTTP/1.1 200 OK http://sabre.io/ns/sync/{$token->id} ", false); } public function test_caldav_birthdays_sync_collection_init() { $user = $this->signin(); $contact = factory(Contact::class)->create([ 'account_id' => $user->account_id, ]); $specialDate = $contact->setSpecialDate('birthdate', 1983, 03, 04); $specialDate->uuid = Str::uuid(); $specialDate->save(); $response = $this->call('REPORT', "/dav/calendars/{$user->email}/birthdays/", [], [], [], [ 'content-type' => 'application/xml; charset=utf-8', ], " 1 " ); $response->assertStatus(207); $response->assertHeader('X-Sabre-Version'); $tokens = SyncToken::where([ 'account_id' => $user->account_id, 'user_id' => $user->id, 'name' => 'birthdays', ])->orderBy('created_at')->get(); $this->assertGreaterThan(0, $tokens->count()); $token = $tokens->last(); $response->assertSee(" /dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics "{$this->getEtag($specialDate)}" HTTP/1.1 200 OK http://sabre.io/ns/sync/{$token->id} ", false); } }