feat(db): add entities
This commit is contained in:
38
tests/Db/Users/UserRepositoryTest.php
Normal file
38
tests/Db/Users/UserRepositoryTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Db\Users;
|
||||
|
||||
use App\Repository\Users\UserRepository;
|
||||
use App\Tests\Common\DatabaseTestTrait;
|
||||
use App\Tests\Common\FakerTrait;
|
||||
use App\Tests\Common\Generators\UserGeneratorTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
class UserRepositoryTest extends KernelTestCase
|
||||
{
|
||||
use FakerTrait;
|
||||
use DatabaseTestTrait;
|
||||
use UserGeneratorTrait;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::bootKernel();
|
||||
$this->bootFaker();
|
||||
$this->bootDatabase();
|
||||
}
|
||||
|
||||
public function testFindByIdsWillReturnOnlyIdsWhichExists(): void
|
||||
{
|
||||
$user = $this->createUser(1);
|
||||
/**
|
||||
* @var UserRepository $userRepository
|
||||
*/
|
||||
$userRepository = parent::getContainer()->get(UserRepository::class);
|
||||
$result = $userRepository->findByIds([1, /* non existent ids */ 2]);
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertSame(1, $result[1]->id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user