mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
merge conflicts resolved
This commit is contained in:
commit
df61fbff12
@ -259,6 +259,7 @@ and this project adheres to
|
|||||||
* add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232
|
* add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232
|
||||||
* [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
* [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
||||||
* [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
* [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties
|
||||||
|
* [period] Validation added when period is confidential and confirmed -> user cannot be null.
|
||||||
|
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
@ -500,6 +500,20 @@ class AccompanyingPeriod implements
|
|||||||
return end($periods) === $this;
|
return end($periods) === $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Assert\Callback
|
||||||
|
*/
|
||||||
|
public function canUserBeNull(ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
|
if ($this->getStep() === self::STEP_CONFIRMED && $this->isConfidential() === true) {
|
||||||
|
if (!$this->getUser()) {
|
||||||
|
$context->buildViolation('User cannot be null for an accompanying period that is confirmed and confidential')
|
||||||
|
->atPath('user')
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a participation for a person.
|
* Close a participation for a person.
|
||||||
*
|
*
|
||||||
@ -938,7 +952,7 @@ class AccompanyingPeriod implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validation function.
|
* Validation functions.
|
||||||
*/
|
*/
|
||||||
public function isDateConsistent(ExecutionContextInterface $context)
|
public function isDateConsistent(ExecutionContextInterface $context)
|
||||||
{
|
{
|
||||||
|
@ -11,11 +11,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Tests\AccompanyingPeriod;
|
namespace Chill\PersonBundle\Tests\AccompanyingPeriod;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -42,7 +43,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataGenerateRandomAccompanyingCourse()
|
public function testConfidentialInvalid()
|
||||||
{
|
{
|
||||||
// Disabling this dataprovider to avoid having errors while running the test.
|
// Disabling this dataprovider to avoid having errors while running the test.
|
||||||
return yield from [];
|
return yield from [];
|
||||||
@ -88,10 +89,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testConfidentialValid()
|
||||||
* @dataProvider dataGenerateRandomAccompanyingCourse
|
|
||||||
*/
|
|
||||||
public function testRemoveUserWhenConfidential(int $periodId)
|
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'Marked as incomplete because of a problem in the dataprovider, at line 81.'
|
'Marked as incomplete because of a problem in the dataprovider, at line 81.'
|
||||||
@ -101,8 +99,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
|
|||||||
->find($periodId);
|
->find($periodId);
|
||||||
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager');
|
$em = self::$kernel->getContainer()->get('doctrine.orm.entity_manager');
|
||||||
|
|
||||||
$isConfidential = $period->isConfidential();
|
$violations = self::$validator->validate($period, null, ['confirmed']);
|
||||||
$step = $period->getStep();
|
|
||||||
|
|
||||||
$initialUser = $period->getUser();
|
$initialUser = $period->getUser();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user