This commit is contained in:
2022-10-05 15:23:28 +02:00
parent 58b1778544
commit a967e1ed17
194 changed files with 1580 additions and 1386 deletions

View File

@@ -1,5 +1,14 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Tests\Repository;
use Chill\MainBundle\Entity\User;
@@ -14,16 +23,21 @@ use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Security\Core\Security;
use function count;
class PersonACLAwareRepositoryTest extends KernelTestCase
/**
* @internal
* @coversNothing
*/
final class PersonACLAwareRepositoryTest extends KernelTestCase
{
use ProphecyTrait;
private EntityManagerInterface $entityManager;
private CenterRepositoryInterface $centerRepository;
private CountryRepository $countryRepository;
private CenterRepositoryInterface $centerRepository;
private EntityManagerInterface $entityManager;
protected function setUp(): void
{
@@ -32,7 +46,6 @@ class PersonACLAwareRepositoryTest extends KernelTestCase
$this->entityManager = self::$container->get(EntityManagerInterface::class);
$this->countryRepository = self::$container->get(CountryRepository::class);
$this->centerRepository = self::$container->get(CenterRepositoryInterface::class);
}
public function testCountByCriteria()
@@ -46,8 +59,12 @@ class PersonACLAwareRepositoryTest extends KernelTestCase
$security = $this->prophesize(Security::class);
$security->getUser()->willReturn($user);
$repository = new PersonACLAwareRepository($security->reveal(), $this->entityManager, $this->countryRepository,
$authorizationHelper->reveal());
$repository = new PersonACLAwareRepository(
$security->reveal(),
$this->entityManager,
$this->countryRepository,
$authorizationHelper->reveal()
);
$number = $repository->countBySearchCriteria('diallo');
@@ -65,13 +82,18 @@ class PersonACLAwareRepositoryTest extends KernelTestCase
$security = $this->prophesize(Security::class);
$security->getUser()->willReturn($user);
$repository = new PersonACLAwareRepository($security->reveal(), $this->entityManager, $this->countryRepository,
$authorizationHelper->reveal());
$repository = new PersonACLAwareRepository(
$security->reveal(),
$this->entityManager,
$this->countryRepository,
$authorizationHelper->reveal()
);
$results = $repository->findBySearchCriteria(0, 5, false, 'diallo');
$this->assertGreaterThan(0, count($results));
$this->assertContainsOnlyInstancesOf(Person::class, $results);
foreach ($results as $person) {
$this->assertStringContainsString('diallo', strtolower($person->getFirstName() . ' ' . $person->getLastName()));
}