diff --git a/tests/Socialbox/AddressBookTest.php b/tests/Socialbox/AddressBookTest.php index 4376b60..89b4667 100644 --- a/tests/Socialbox/AddressBookTest.php +++ b/tests/Socialbox/AddressBookTest.php @@ -43,6 +43,24 @@ $this->assertTrue($aliceClient->addressBookContactExists($johnClient->getIdentifiedAs())); } + /** + * @throws RpcException + * @throws ResolutionException + * @throws CryptographyException + * @throws DatabaseOperationException + */ + public function testAddressBookAddInvalidAddress(): void + { + $johnClient = Helper::generateRandomClient(TEAPOT_DOMAIN, prefix: 'johnAddressBookTest'); + $johnClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe'); + $johnClient->settingsSetPassword('SecretTestingPassword123'); + $this->assertTrue($johnClient->getSessionState()->isAuthenticated()); + + $this->expectException(RpcException::class); + $this->expectExceptionCode(StandardError::RPC_INVALID_ARGUMENTS->value); + $johnClient->addressBookAddContact('invalid invalid invalid'); + } + /** * @throws ResolutionException * @throws RpcException @@ -617,6 +635,23 @@ $this->assertFalse($johnClient->addressBookDeleteContact(Helper::generateRandomPeer($johnClient->getIdentifiedAs()->getDomain()))); } + /** + * @throws RpcException + * @throws ResolutionException + * @throws CryptographyException + * @throws DatabaseOperationException + */ + public function testDeleteInvalidContact(): void + { + $johnClient = Helper::generateRandomClient(TEAPOT_DOMAIN, prefix: 'johnAddressBookTest'); + $this->assertTrue($johnClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe', PrivacyState::PUBLIC)); + $this->assertTrue($johnClient->settingsSetPassword('SecretTestingPassword123')); + + $this->expectException(RpcException::class); + $this->expectExceptionCode(StandardError::RPC_INVALID_ARGUMENTS->value); + $this->assertFalse($johnClient->addressBookDeleteContact('invalid invalid invalid')); + } + /** * @throws DatabaseOperationException * @throws ResolutionException