mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Fixed: add string key for summary of charges and resources into doc generation
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user