Fixed: add string key for summary of charges and resources into doc generation

This commit is contained in:
2023-02-07 15:09:40 +01:00
parent c64ec89274
commit 88eefa698b
8 changed files with 349 additions and 26 deletions

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
/*
* 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.
*/
namespace Validator\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlap;
use Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod\ParticipationOverlapValidator;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Doctrine\Common\Collections\ArrayCollection;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class ParticipationOverlapValidatorTest extends ConstraintValidatorTestCase
{
use ProphecyTrait;
protected function createValidator()
{
$personRender = $this->prophesize(PersonRenderInterface::class);
$personRender->renderString(Argument::is(Person::class), [])->willReturn('person');
$thirdPartyRender = $this->prophesize(ThirdPartyRender::class);
$thirdPartyRender->renderString(Argument::is(ThirdParty::class), [])->willReturn('thirdparty');
return new ParticipationOverlapValidator($personRender->reveal(), $thirdPartyRender->reveal());
}
public function testOneParticipation()
{
$period = new AccompanyingPeriod();
$person = new Person();
$collection = new ArrayCollection([
new AccompanyingPeriodParticipation($period, $person)
]);
$this->validator->validate($collection, $this->getConstraint());
$this->assertNoViolation();
}
/**
* @return mixed
*/
public function getConstraint()
{
return new ParticipationOverlap();
}
}