mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
Remove ManipulatorInterface::getRepository method
This commit is contained in:
@@ -9,7 +9,7 @@ class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testCreateRegistration()
|
||||
{
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$registration = $service->createRegistration(self::$DI['user'], self::$DI['collection']);
|
||||
|
||||
$this->assertInstanceOf('Alchemy\Phrasea\Model\Entities\Registration', $registration);
|
||||
@@ -21,7 +21,7 @@ class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||
{
|
||||
$registration = self::$DI['registration_1'];
|
||||
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$service->rejectRegistration($registration);
|
||||
|
||||
$this->assertFalse($registration->isPending());
|
||||
@@ -48,13 +48,13 @@ class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
self::$DI['app']['acl'] = $aclProviderMock;
|
||||
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$service->acceptRegistration($registration, true, false);
|
||||
}
|
||||
|
||||
public function testDeleteRegistrationForUser()
|
||||
{
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||
$nbRegistrationBefore = $qb->select('COUNT(r)')
|
||||
->where($qb->expr()->eq('r.user', ':user'))
|
||||
@@ -68,7 +68,7 @@ class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testDeleteOldRegistrations()
|
||||
{
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||
$nbRegistrationBefore = $qb->select('COUNT(r)')->getQuery()->getSingleScalarResult();
|
||||
$service->deleteOldRegistrations();
|
||||
@@ -78,7 +78,7 @@ class RegistrationManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testDeleteRegistrationOnCollection()
|
||||
{
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox']);
|
||||
$service = new RegistrationManipulator(self::$DI['app'], self::$DI['app']['EM'], self::$DI['app']['acl'], self::$DI['app']['phraseanet.appbox'], self::$DI['app']['repo.registrations']);
|
||||
$qb = $service->getRepository()->createQueryBuilder('r');
|
||||
$nbRegistrationBefore = $qb->select('COUNT(r)')->getQuery()->getSingleScalarResult();
|
||||
$service->deleteRegistrationsOnCollection(self::$DI['collection']);
|
||||
|
@@ -15,7 +15,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_CREATE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$this->assertCount(2, $this->findAllTasks());
|
||||
$task = $manipulator->create('prout', 'bla bla', 'super settings', 0);
|
||||
$this->assertEquals('prout', $task->getName());
|
||||
@@ -36,7 +36,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_UPDATE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $this->loadTask();
|
||||
$task->setName('new name');
|
||||
$this->assertSame($task, $manipulator->update($task));
|
||||
@@ -52,7 +52,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_DELETE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $this->loadTask();
|
||||
$manipulator->delete($task);
|
||||
$this->assertNotContains($task, $this->findAllTasks());
|
||||
@@ -65,7 +65,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_UPDATE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $this->loadTask();
|
||||
$task->setStatus(Task::STATUS_STOPPED);
|
||||
self::$DI['app']['EM']->persist($task);
|
||||
@@ -81,7 +81,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_UPDATE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $this->loadTask();
|
||||
$task->setStatus(Task::STATUS_STARTED);
|
||||
self::$DI['app']['EM']->persist($task);
|
||||
@@ -97,7 +97,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('notify')
|
||||
->with(Notifier::MESSAGE_UPDATE);
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $notifier, self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $this->loadTask();
|
||||
$task->setCrashed(42);
|
||||
$manipulator->resetCrashes($task);
|
||||
@@ -106,7 +106,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
|
||||
public function testGetRepository()
|
||||
{
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $this->createNotifierMock(), self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $this->createNotifierMock(), self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$this->assertSame(self::$DI['app']['EM']->getRepository('Phraseanet:Task'), $manipulator->getRepository());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class TaskManipulatorTest extends \PhraseanetTestCase
|
||||
->method('get_base_id')
|
||||
->will($this->returnValue(42));
|
||||
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $this->createNotifierMock(), self::$DI['app']['translator']);
|
||||
$manipulator = new TaskManipulator(self::$DI['app']['EM'], $this->createNotifierMock(), self::$DI['app']['translator'], self::$DI['app']['repo.tasks']);
|
||||
$task = $manipulator->createEmptyCollectionJob($collection);
|
||||
|
||||
$tasks = self::$DI['app']['EM']->getRepository('Phraseanet:Task')->findAll();
|
||||
|
@@ -74,7 +74,7 @@ class UserManipulatorTest extends \PhraseanetTestCase
|
||||
->getMock();
|
||||
|
||||
$user = self::$DI['app']['manipulator.user']->createUser('login', 'password');
|
||||
$manipulator = new UserManipulator($manager, $passwordInterface, $geonamesConnector);
|
||||
$manipulator = new UserManipulator($manager, $passwordInterface, $geonamesConnector, self::$DI['app']['repo.tasks']);
|
||||
|
||||
$manipulator->setGeonameId($user, 4);
|
||||
$this->assertEquals(4, $user->getGeonameId());
|
||||
@@ -140,7 +140,7 @@ class UserManipulatorTest extends \PhraseanetTestCase
|
||||
$passwordInterface = $this->getMockBuilder('Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface')
|
||||
->getMock();
|
||||
$user = self::$DI['app']['manipulator.user']->createUser('login', 'password');
|
||||
$manipulator = new UserManipulator($manager, $passwordInterface, $geonamesConnector);
|
||||
$manipulator = new UserManipulator($manager, $passwordInterface, $geonamesConnector, self::$DI['app']['repo.tasks']);
|
||||
$this->setExpectedException(
|
||||
'Alchemy\Phrasea\Exception\InvalidArgumentException',
|
||||
'Invalid geonameid -1.'
|
||||
|
Reference in New Issue
Block a user