-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add InMemoryContactPersonRepositoryImplementation and tests
This commit introduces the InMemoryContactPersonRepositoryImplementation class, which provides an in-memory implementation of the ContactPersonRepositoryInterface. It also includes associated unit test cases to ensure that the implementation behaves as expected. This mainly assists developers in the process of testing without needing a real database. Signed-off-by: mesilov <[email protected]>
- Loading branch information
Showing
4 changed files
with
738 additions
and
0 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Repository; | ||
|
||
use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts; | ||
use Bitrix24\SDK\Application\Contracts\ContactPersons\Entity\ContactPersonInterface; | ||
use Bitrix24\SDK\Application\Contracts\ContactPersons\Entity\ContactPersonStatus; | ||
use Bitrix24\SDK\Application\Contracts\ContactPersons\Exceptions\ContactPersonNotFoundException; | ||
use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; | ||
use libphonenumber\PhoneNumber; | ||
use Symfony\Component\Uid\Uuid; | ||
|
||
interface ContactPersonRepositoryInterface | ||
{ | ||
/** | ||
* Save contact person to persistence storage | ||
*/ | ||
public function save(ContactPersonInterface $contactPerson): void; | ||
|
||
/** | ||
* Delete contact person from persistence storage | ||
* @throws ContactPersonNotFoundException | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function delete(Uuid $uuid): void; | ||
|
||
/** | ||
* Get contact person by id | ||
* @throws ContactPersonNotFoundException | ||
*/ | ||
public function getById(Uuid $uuid): ContactPersonInterface; | ||
|
||
/** | ||
* Find contact persons with email and filter by status and isEmailVerified flag | ||
* @param non-empty-string $email | ||
* @param ContactPersonStatus|null $status | ||
* @param bool|null $isEmailVerified | ||
* @return ContactPersonInterface[] | ||
*/ | ||
public function findByEmail(string $email, ?ContactPersonStatus $status = null, ?bool $isEmailVerified = null): array; | ||
|
||
/** | ||
* Find contact persons with PhoneNumber and filter by status and isEmailVerified flag | ||
* @param PhoneNumber $phoneNumber | ||
* @param ContactPersonStatus|null $status | ||
* @param bool|null $isPhoneVerified | ||
* @return ContactPersonInterface[] | ||
*/ | ||
public function findByPhone(PhoneNumber $phoneNumber, ?ContactPersonStatus $status = null, ?bool $isPhoneVerified = null): array; | ||
|
||
/** | ||
* Find contact person by external id | ||
* | ||
* @param non-empty-string $externalId | ||
* @return ContactPersonInterface|null | ||
*/ | ||
public function findByExternalId(string $externalId): ?ContactPersonInterface; | ||
} |
Oops, something went wrong.