mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix tests, CS && typo
This commit is contained in:
@@ -445,7 +445,7 @@ class Users implements ControllerProviderInterface
|
||||
foreach ($deny as $usr => $bases) {
|
||||
$cache_to_update[$usr] = true;
|
||||
foreach ($bases as $bas) {
|
||||
if (null !== $registration = $this->getRepository()->findOneBy([
|
||||
if (null !== $registration = $app['registration-manager']->getRepository()->findOneBy([
|
||||
'user' => $usr,
|
||||
'baseId' => $bas
|
||||
])) {
|
||||
@@ -461,12 +461,12 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
foreach ($bases as $bas) {
|
||||
$collection = \collection::get_from_base_id($app, $bas);
|
||||
if (null !== $registration = $this->getRepository()->findOneBy([
|
||||
if (null !== $registration = $app['registration-manager']->getRepository()->findOneBy([
|
||||
'user' => $user->get_id(),
|
||||
'baseId' => $collection->get_base_id()
|
||||
])) {
|
||||
$done[$usr][$bas] = true;
|
||||
$app['registration-manager']->acceptDemand($registration, $user, $collection, $options[$usr][$bas]['HD'], $options[$usr][$bas]['WM']);
|
||||
$app['registration-manager']->acceptRegistration($registration, $user, $collection, $options[$usr][$bas]['HD'], $options[$usr][$bas]['WM']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,11 +81,6 @@ class PhraseaRegisterForm extends AbstractType
|
||||
if (false === $collInfo['can-register']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($choices[$dbName])) {
|
||||
$choices[$dbName] = [];
|
||||
}
|
||||
|
||||
$choices[$dbName][$baseId] = \phrasea::bas_labels($baseId, $this->app);
|
||||
$baseIds[] = $baseId;
|
||||
}
|
||||
|
@@ -54,8 +54,7 @@ class RegistrationManager
|
||||
/**
|
||||
* Rejects a registration.
|
||||
*
|
||||
* @param $usrId
|
||||
* @param $baseId
|
||||
* @param Registration $registration
|
||||
*/
|
||||
public function rejectRegistration(Registration $registration)
|
||||
{
|
||||
@@ -68,8 +67,11 @@ class RegistrationManager
|
||||
/**
|
||||
* Accepts a registration.
|
||||
*
|
||||
* @param $userId
|
||||
* @param $basId
|
||||
* @param Registration $registration
|
||||
* @param \User_Adapter $user
|
||||
* @param \Collection $collection
|
||||
* @param bool $grantHd
|
||||
* @param bool $grantWatermark
|
||||
*/
|
||||
public function acceptRegistration(Registration $registration, \User_Adapter $user, \Collection $collection, $grantHd = false, $grantWatermark = false)
|
||||
{
|
||||
@@ -208,6 +210,8 @@ class RegistrationManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes registration for given user.
|
||||
*
|
||||
* @param $userId
|
||||
* @param array $baseList
|
||||
*
|
||||
|
@@ -1484,7 +1484,7 @@ class databox extends base
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the registration is enable for provided databox or not.
|
||||
* Tells whether the registration is enable or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
@@ -172,7 +172,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if table['users'] | length > 0 %}
|
||||
{% if users | length > 0 %}
|
||||
<form id="accept-demand" action="{{ path('users_submit_demands') }}" method="post">
|
||||
<div class="btn-group btn-all-action">
|
||||
<button data-event="deny" class="btn deny-checker" type="button">
|
||||
|
@@ -368,18 +368,6 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testRenderDemands()
|
||||
{
|
||||
$nativeQueryMock = $this->getMockBuilder('Alchemy\Phrasea\Model\NativeQueryProvider')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$nativeQueryMock->expects($this->once())->method('getUsersRegistrationDemand')->will($this->returnValue([[
|
||||
self::$DI['user'],
|
||||
'date_demand' => new \DateTime(),
|
||||
'base_demand' => 1
|
||||
]]));
|
||||
|
||||
self::$DI['app']['EM.native-query'] = $nativeQueryMock;
|
||||
|
||||
self::$DI['client']->request('GET', '/admin/users/demands/');
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||
}
|
||||
|
Reference in New Issue
Block a user