fix: fix carddav addressbook add (#5660)
This commit is contained in:
@@ -89,11 +89,12 @@ class DavTester extends TestCase
|
||||
|
||||
public function addressBookBaseUri()
|
||||
{
|
||||
return $this->serviceUrl()
|
||||
->optionsOk()
|
||||
->userPrincipal()
|
||||
return $this->userPrincipal('https://test')
|
||||
->optionsOk('https://test/dav/principals/user@test.com/')
|
||||
->userPrincipal('https://test/dav/principals/user@test.com/')
|
||||
->addressbookHome()
|
||||
->resourceTypeAddressBook();
|
||||
->resourceTypeAddressBook()
|
||||
->optionsOk('https://test/dav/addressbooks/user@test.com/contacts/');
|
||||
}
|
||||
|
||||
public function capabilities()
|
||||
@@ -125,9 +126,9 @@ class DavTester extends TestCase
|
||||
return $this->addResponse('https://test/.well-known/carddav', Http::response(null, 301, ['Location' => '/dav/']), null, 'PROPFIND');
|
||||
}
|
||||
|
||||
public function optionsOk()
|
||||
public function optionsOk(string $url = 'https://test/dav/')
|
||||
{
|
||||
return $this->addResponse('https://test/dav/', Http::response(null, 200, ['Dav' => '1, 3, addressbook']), null, 'OPTIONS');
|
||||
return $this->addResponse($url, Http::response(null, 200, ['Dav' => '1, 3, addressbook']), null, 'OPTIONS');
|
||||
}
|
||||
|
||||
public function optionsFail()
|
||||
@@ -135,9 +136,9 @@ class DavTester extends TestCase
|
||||
return $this->addResponse('https://test/dav/', Http::response(null, 200, ['Dav' => 'bad']), null, 'OPTIONS');
|
||||
}
|
||||
|
||||
public function userPrincipal()
|
||||
public function userPrincipal(string $url = 'https://test/dav/')
|
||||
{
|
||||
return $this->addResponse('https://test/dav/', Http::response($this->multistatusHeader().
|
||||
return $this->addResponse($url, Http::response($this->multistatusHeader().
|
||||
'<d:response>'.
|
||||
'<d:href>/dav/</d:href>'.
|
||||
'<d:propstat>'.
|
||||
|
||||
@@ -45,6 +45,7 @@ class AddressBookGetterTest extends TestCase
|
||||
public function it_fails_on_server_not_compliant()
|
||||
{
|
||||
$tester = (new DavTester())
|
||||
->userPrincipalEmpty()
|
||||
->serviceUrl()
|
||||
->optionsFail()
|
||||
->fake();
|
||||
@@ -59,6 +60,7 @@ class AddressBookGetterTest extends TestCase
|
||||
public function it_fails_if_no_userprincipal()
|
||||
{
|
||||
$tester = (new DavTester())
|
||||
->userPrincipalEmpty()
|
||||
->serviceUrl()
|
||||
->optionsOk()
|
||||
->userPrincipalEmpty()
|
||||
@@ -74,6 +76,7 @@ class AddressBookGetterTest extends TestCase
|
||||
public function it_fails_if_no_addressbook()
|
||||
{
|
||||
$tester = (new DavTester())
|
||||
->userPrincipalEmpty()
|
||||
->serviceUrl()
|
||||
->optionsOk()
|
||||
->userPrincipal()
|
||||
@@ -90,11 +93,13 @@ class AddressBookGetterTest extends TestCase
|
||||
public function it_fails_if_no_addressbook_url()
|
||||
{
|
||||
$tester = (new DavTester())
|
||||
->userPrincipalEmpty()
|
||||
->serviceUrl()
|
||||
->optionsOk()
|
||||
->userPrincipal()
|
||||
->addressbookHome()
|
||||
->resourceTypeHomeOnly()
|
||||
->optionsOk()
|
||||
->fake();
|
||||
$client = $tester->client();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user