mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 18:33:13 +00:00
Rename RegistrationManager to RegistrationManipulator
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
namespace Alchemy\Phrasea\Core\Provider;
|
namespace Alchemy\Phrasea\Core\Provider;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Form\Constraint\NewLogin;
|
use Alchemy\Phrasea\Form\Constraint\NewLogin;
|
||||||
use Alchemy\Phrasea\Registration\RegistrationManager;
|
use Alchemy\Phrasea\Model\Manipulator\RegistrationManipulator;
|
||||||
use Alchemy\Phrasea\Model\Entities\User;
|
use Alchemy\Phrasea\Model\Entities\User;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ServiceProviderInterface;
|
use Silex\ServiceProviderInterface;
|
||||||
@@ -132,7 +132,7 @@ class RegistrationServiceProvider implements ServiceProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$app['registration-manager'] = $app->share(function (Application $app) {
|
$app['registration-manager'] = $app->share(function (Application $app) {
|
||||||
return new RegistrationManager($app['EM'], $app['phraseanet.appbox'], $app['acl']);
|
return new RegistrationManipulator($app['EM'], $app['phraseanet.appbox'], $app['acl']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Alchemy\Phrasea\Registration;
|
namespace Alchemy\Phrasea\Model\Manipulator;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Authentication\ACLProvider;
|
use Alchemy\Phrasea\Authentication\ACLProvider;
|
||||||
use Alchemy\Phrasea\Model\Entities\Registration;
|
use Alchemy\Phrasea\Model\Entities\Registration;
|
||||||
@@ -17,7 +17,7 @@ use Alchemy\Phrasea\Model\Repositories\RegistrationRepository;
|
|||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use igorw;
|
use igorw;
|
||||||
|
|
||||||
class RegistrationManager
|
class RegistrationManipulator implements ManipulatorInterface
|
||||||
{
|
{
|
||||||
private $em;
|
private $em;
|
||||||
private $appbox;
|
private $appbox;
|
||||||
@@ -84,7 +84,7 @@ class AccountTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
$service = $this->getMockBuilder('Alchemy\Phrasea\Registration\RegistrationManager')
|
$service = $this->getMockBuilder('Alchemy\Phrasea\Model\Manipulator\RegistrationManipulator')
|
||||||
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
||||||
->setMethods(['getRegistrationSummary'])
|
->setMethods(['getRegistrationSummary'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
self::$DI['app']['registration.fields'] = [];
|
self::$DI['app']['registration.fields'] = [];
|
||||||
$this->logout(self::$DI['app']);
|
$this->logout(self::$DI['app']);
|
||||||
|
|
||||||
$managerMock = $this->getMockBuilder('Alchemy\Phrasea\Registration\RegistrationManager')
|
$managerMock = $this->getMockBuilder('Alchemy\Phrasea\Model\Manipulator\RegistrationManipulator')
|
||||||
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
||||||
->setMethods(['getRepository'])
|
->setMethods(['getRepository'])
|
||||||
->getMock();
|
->getMock();
|
||||||
@@ -1468,7 +1468,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
public function testAuthenticateProviderCallbackAlreadyBound()
|
public function testAuthenticateProviderCallbackAlreadyBound()
|
||||||
{
|
{
|
||||||
$managerMock = $this->getMockBuilder('Alchemy\Phrasea\Registration\RegistrationManager')
|
$managerMock = $this->getMockBuilder('Alchemy\Phrasea\Model\Manipulator\RegistrationManipulator')
|
||||||
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
->setConstructorArgs([self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']])
|
||||||
->setMethods(['getRepository'])
|
->setMethods(['getRepository'])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ namespace Alchemy\Tests\Phrasea\Registration;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\Model\Entities\Registration;
|
use Alchemy\Phrasea\Model\Entities\Registration;
|
||||||
use Alchemy\Phrasea\Registration\RegistrationManager;
|
use Alchemy\Phrasea\Model\Manipulator\RegistrationManipulator;
|
||||||
|
|
||||||
class RegistrationManagerTest extends \PhraseanetTestCase
|
class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||||
{
|
{
|
||||||
public function testCreateRegistration()
|
public function testCreateRegistration()
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
$em->expects($this->once())->method('persist')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
$em->expects($this->once())->method('persist')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
||||||
$em->expects($this->once())->method('flush');
|
$em->expects($this->once())->method('flush');
|
||||||
|
|
||||||
$service = new RegistrationManager($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
|
|
||||||
$registration = $service->createRegistration(self::$DI['user']->get_id(), self::$DI['collection']->get_base_id());
|
$registration = $service->createRegistration(self::$DI['user']->get_id(), self::$DI['collection']->get_base_id());
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
$em->expects($this->once())->method('persist')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
$em->expects($this->once())->method('persist')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
||||||
$em->expects($this->once())->method('flush');
|
$em->expects($this->once())->method('flush');
|
||||||
|
|
||||||
$service = new RegistrationManager($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
|
|
||||||
$service->rejectRegistration($registration);
|
$service->rejectRegistration($registration);
|
||||||
$this->assertFalse($registration->isPending());
|
$this->assertFalse($registration->isPending());
|
||||||
@@ -74,13 +74,13 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
$em->expects($this->once())->method('remove')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
$em->expects($this->once())->method('remove')->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\Registration'));
|
||||||
$em->expects($this->once())->method('flush');
|
$em->expects($this->once())->method('flush');
|
||||||
|
|
||||||
$service = new RegistrationManager($em, self::$DI['app']['phraseanet.appbox'], $aclProviderMock);
|
$service = new RegistrationManipulator($em, self::$DI['app']['phraseanet.appbox'], $aclProviderMock);
|
||||||
$service->acceptRegistration($registration, self::$DI['user'], self::$DI['collection'], true, false);
|
$service->acceptRegistration($registration, self::$DI['user'], self::$DI['collection'], true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteRegistrationForUser()
|
public function testDeleteRegistrationForUser()
|
||||||
{
|
{
|
||||||
$service = new RegistrationManager(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||||
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
||||||
->where($qb->expr()->eq('r.user', ':user'))
|
->where($qb->expr()->eq('r.user', ':user'))
|
||||||
@@ -94,7 +94,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
public function testDeleteOldRegistrations()
|
public function testDeleteOldRegistrations()
|
||||||
{
|
{
|
||||||
$service = new RegistrationManager(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||||
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
@@ -106,7 +106,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
|
|
||||||
public function testDeleteRegistrationOnCollection()
|
public function testDeleteRegistrationOnCollection()
|
||||||
{
|
{
|
||||||
$service = new RegistrationManager(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator(self::$DI['app']['EM'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||||
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
||||||
->getQuery()
|
->getQuery()
|
||||||
@@ -131,7 +131,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
|||||||
->getMock();
|
->getMock();
|
||||||
$em->expects($this->once())->method('getRepository')->will($this->returnValue($repoMock));
|
$em->expects($this->once())->method('getRepository')->will($this->returnValue($repoMock));
|
||||||
|
|
||||||
$service = new RegistrationManager($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
$service = new RegistrationManipulator($em, self::$DI['app']['phraseanet.appbox'], self::$DI['app']['acl']);
|
||||||
|
|
||||||
$rs = $service->getRegistrationSummary(4);
|
$rs = $service->getRegistrationSummary(4);
|
||||||
|
|
||||||
Reference in New Issue
Block a user