Skip to content

Commit

Permalink
Add functional test for Bitrix24AccountRepository
Browse files Browse the repository at this point in the history
Introduced `Bitrix24AccountRepositoryTest` to ensure the repository's correct functionality. Modified the Makefile to run the functional tests suite with more detailed output including warnings.

Signed-off-by: mesilov <[email protected]>
  • Loading branch information
mesilov committed Oct 6, 2024
1 parent 1ecbe1c commit ace9189
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ test-run-unit:
test-run-functional:
docker-compose run --rm php-cli php bin/doctrine orm:schema-tool:drop --force
docker-compose run --rm php-cli php bin/doctrine orm:schema-tool:create
docker-compose run --rm php-cli php vendor/bin/phpunit --testsuite=functional --testdox
docker-compose run --rm php-cli php vendor/bin/phpunit --testsuite=functional_tests --display-warnings --testdox
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* This file is part of the bitrix24-php-lib package.
*
* © Maksim Mesilov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Lib\Tests\Functional\Bitrix24Accounts\Infrastructure\Doctrine;

use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface;
use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountStatus;
use Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterface;
use Bitrix24\SDK\Lib\Bitrix24Accounts\Entity\Bitrix24Account;
use Bitrix24\SDK\Core\Credentials\AuthToken;
use Bitrix24\SDK\Core\Credentials\Scope;
use Bitrix24\SDK\Lib\Bitrix24Accounts\Infrastructure\Doctrine\Bitrix24AccountRepository;
use Bitrix24\SDK\Lib\Tests\EntityManagerFactory;
use Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Accounts\Repository\Bitrix24AccountRepositoryInterfaceTest;
use Carbon\CarbonImmutable;
use Override;
use PHPUnit\Framework\Attributes\CoversClass;
use Symfony\Component\Uid\Uuid;

#[CoversClass(Bitrix24AccountRepository::class)]
class Bitrix24AccountRepositoryTest extends Bitrix24AccountRepositoryInterfaceTest
{
#[Override]
protected function createBitrix24AccountImplementation(
Uuid $uuid,
int $bitrix24UserId,
bool $isBitrix24UserAdmin,
string $memberId,
string $domainUrl,
Bitrix24AccountStatus $bitrix24AccountStatus,
AuthToken $authToken,
CarbonImmutable $createdAt,
CarbonImmutable $updatedAt,
int $applicationVersion,
Scope $applicationScope
): Bitrix24AccountInterface
{
return new Bitrix24Account(
$uuid,
$bitrix24UserId,
$isBitrix24UserAdmin,
$memberId,
$domainUrl,
$bitrix24AccountStatus,
$authToken,
$createdAt,
$updatedAt,
$applicationVersion,
$applicationScope
);
}

protected function createBitrix24AccountRepositoryImplementation(): Bitrix24AccountRepositoryInterface
{
return new Bitrix24AccountRepository(EntityManagerFactory::get());
}
}

0 comments on commit ace9189

Please sign in to comment.