mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
Enhanced push tests
This commit is contained in:
@@ -214,6 +214,8 @@ class Push implements ControllerProviderInterface
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
$em->refresh($Basket);
|
||||
|
||||
if (!$Basket->getValidation())
|
||||
{
|
||||
$Validation = new \Entities\ValidationSession();
|
||||
@@ -233,6 +235,12 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
foreach ($participants as $participant)
|
||||
{
|
||||
foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam)
|
||||
{
|
||||
if (!array_key_exists($mandatoryparam, $participant))
|
||||
throw new ControllerException(sprintf(_('Missing mandatory participant parameter %s'), $mandatoryparam));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$participant_user = \User_Adapter::getInstance($participant['usr_id'], $appbox);
|
||||
@@ -265,7 +273,7 @@ class Push implements ControllerProviderInterface
|
||||
{
|
||||
$ValidationData = new \Entities\ValidationData();
|
||||
$ValidationData->setParticipant($Participant);
|
||||
$validationData->setBasketElement($BasketElement);
|
||||
$ValidationData->setBasketElement($BasketElement);
|
||||
$BasketElement->addValidationData($ValidationData);
|
||||
|
||||
if ($participant['HD'])
|
||||
@@ -286,7 +294,7 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
$em->merge($BasketElement);
|
||||
$em->persists($ValidationData);
|
||||
$em->persist($ValidationData);
|
||||
|
||||
$Participant->addValidationData($ValidationData);
|
||||
}
|
||||
@@ -300,9 +308,9 @@ class Push implements ControllerProviderInterface
|
||||
$em->flush();
|
||||
|
||||
$message = sprintf(
|
||||
_('%1$d records have been sent to %2$d users')
|
||||
_('%1$d records have been sent for validation to %2$d users')
|
||||
, count($pusher->get_elements())
|
||||
, count($request->get('receivers'))
|
||||
, count($request->get('$participants'))
|
||||
);
|
||||
|
||||
$ret = array(
|
||||
|
@@ -102,13 +102,13 @@ class ControllerPushTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
'usr_id' => self::$user_alt1->get_id(),
|
||||
'agree'=> 0,
|
||||
'see_others'=> 1,
|
||||
'HS'=> 0,
|
||||
'HD'=> 0,
|
||||
)
|
||||
, array(
|
||||
'usr_id' => self::$user_alt2->get_id(),
|
||||
'agree'=> 1,
|
||||
'see_others'=> 0,
|
||||
'HS'=> 1,
|
||||
'HD'=> 1,
|
||||
)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user