Add unit tests for AddressBook functionality
This commit is contained in:
parent
3935980146
commit
49f400acdb
1 changed files with 39 additions and 0 deletions
39
tests/Socialbox/AddressBookTest.php
Normal file
39
tests/Socialbox/AddressBookTest.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Socialbox;
|
||||||
|
|
||||||
|
use Helper;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Socialbox\Enums\Types\InformationFieldName;
|
||||||
|
use Socialbox\Exceptions\CryptographyException;
|
||||||
|
use Socialbox\Exceptions\DatabaseOperationException;
|
||||||
|
use Socialbox\Exceptions\ResolutionException;
|
||||||
|
use Socialbox\Exceptions\RpcException;
|
||||||
|
|
||||||
|
class AddressBookTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws ResolutionException
|
||||||
|
* @throws RpcException
|
||||||
|
* @throws CryptographyException
|
||||||
|
* @throws DatabaseOperationException
|
||||||
|
*/
|
||||||
|
public function testAddressBookAdd(): void
|
||||||
|
{
|
||||||
|
$johnClient = Helper::generateRandomClient(TEAPOT_DOMAIN, prefix: 'johnAddressBookTest');
|
||||||
|
$johnClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'John Doe');
|
||||||
|
$johnClient->settingsSetPassword('SecretTestingPassword123');
|
||||||
|
$this->assertTrue($johnClient->getSessionState()->isAuthenticated());
|
||||||
|
|
||||||
|
$aliceClient = Helper::generateRandomClient(COFFEE_DOMAIN, prefix: 'aliceAddressBookTest');
|
||||||
|
$aliceClient->settingsAddInformationField(InformationFieldName::DISPLAY_NAME, 'Alice Smith');
|
||||||
|
$aliceClient->settingsSetPassword('SecretTestingPassword123');
|
||||||
|
$this->assertTrue($aliceClient->getSessionState()->isAuthenticated());
|
||||||
|
|
||||||
|
$johnClient->addressBookAddContact($aliceClient->getIdentifiedAs());
|
||||||
|
$this->assertTrue($johnClient->addressBookContactExists($aliceClient->getIdentifiedAs()));
|
||||||
|
|
||||||
|
$aliceClient->addressBookAddContact($johnClient->getIdentifiedAs());
|
||||||
|
$this->assertTrue($aliceClient->addressBookContactExists($johnClient->getIdentifiedAs()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue