Replace delete method

This commit is contained in:
Nicolas Le Goff
2013-11-16 19:55:19 +01:00
parent 54a5d6578c
commit 002d949f6c
10 changed files with 36 additions and 38 deletions

View File

@@ -71,7 +71,7 @@ class GuiContext extends MinkContext
$this->app['authentication']->getUser()->ACL()->get_granted_base(array('canadmin'))
));
$user->delete();
$this->app['model.user-manager']->delete($user);
}
}

View File

@@ -78,7 +78,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
$this->app['acl']->get($user)->revoke_access_from_bases($list);
if ($this->app['acl']->get($user)->is_phantom()) {
$user->delete();
$this->app['model.user-manager']->delete($user);
}
return $this;

View File

@@ -57,7 +57,8 @@ class AccountCreatorTest extends \PhraseanetTestCase
$user = $creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword());
$this->assertInstanceOf('Alchemy\Phrasea\Model\Entities\User', $user);
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testCreateWithTemplates()
@@ -77,10 +78,10 @@ class AccountCreatorTest extends \PhraseanetTestCase
$user = $creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword(), null, $extra);
$this->assertInstanceOf('Alchemy\Phrasea\Model\Entities\User', $user);
$user->delete();
$template1->delete();
$template2->delete();
$template3->delete();
self::$DI['app']['model.user-manager']->delete($user);
self::$DI['app']['model.user-manager']->delete($template1);
self::$DI['app']['model.user-manager']->delete($template2);
self::$DI['app']['model.user-manager']->delete($template3);
}
public function testCreateWithAlreadyExistingLogin()
@@ -90,6 +91,6 @@ class AccountCreatorTest extends \PhraseanetTestCase
$this->assertInstanceOf('Alchemy\Phrasea\Model\Entities\User', $user);
$this->assertNotEquals(self::$DI['user']->getLogin(), $user->getLogin());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
}

View File

@@ -123,7 +123,6 @@ class AdminDashboardTest extends \PhraseanetAuthenticatedWebTestCase
]);
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
}

View File

@@ -69,7 +69,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertTrue(self::$DI['app']['acl']->get($user)->has_right_on_base($base_id, "manage"));
$this->assertTrue(self::$DI['app']['acl']->get($user)->has_right_on_base($base_id, "canpush"));
$this->assertTrue(self::$DI['app']['acl']->get($user)->has_right_on_base($base_id, "canreport"));
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteRightsApplyException()
@@ -87,7 +87,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$datas = json_decode($response->getContent());
$this->assertTrue(is_object($datas));
$this->assertTrue($datas->error);
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteQuota()
@@ -155,7 +155,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['client']->request('POST', '/admin/users/rights/time/apply/', array('base_id' => $base_id, 'dmin' => $dmin, 'dmax' => $dmax, 'limit' => 1, 'users' => $user->getId()));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOK());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteRightTimeApplySbas()
@@ -170,7 +170,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['client']->request('POST', '/admin/users/rights/time/apply/', array('sbas_id' => $sbas_id, 'dmin' => $dmin, 'dmax' => $dmax, 'limit' => 1, 'users' => $user->getId()));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOK());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteRightTimeApplyWithtoutBasOrSbas()
@@ -184,7 +184,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['client']->request('POST', '/admin/users/rights/time/apply/', array('dmin' => $dmin, 'dmax' => $dmax, 'limit' => 1, 'users' => $user->getId()));
$response = self::$DI['client']->getResponse();
$this->assertEquals(400, $response->getStatusCode());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteRightMask()
@@ -208,7 +208,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
));
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOK());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteSearch()
@@ -249,9 +249,8 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isRedirect());
$template->delete();
$user->delete();
self::$DI['app']['model.user-manager']->delete($template);
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteCreateException()
@@ -295,7 +294,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertFalse($datas->error);
$this->assertNotNull($user = (self::$DI['app']['manipulator.user']->getRepository((int) $datas->data)));
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteCreateUserAndSendCredentials()
@@ -318,7 +317,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertFalse($datas->error);
$this->assertNotNull($user = (self::$DI['app']['manipulator.user']->getRepository((int) $datas->data)));
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRouteExportCsv()
@@ -372,7 +371,7 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertTrue(is_object($datas));
$this->assertFalse($datas->error);
$this->assertFalse(self::$DI['app']['acl']->get($user)->has_access_to_base($base_id));
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testRenderDemands()

View File

@@ -244,7 +244,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertFlashMessagePopulated(self::$DI['app'], 'info', 1);
$this->assertEquals('/login/', $response->headers->get('location'));
$this->assertFalse(self::$DI['user']->isMailLocked());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
/**
@@ -1017,7 +1017,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
->findBy(array('usr_id' => $user->getId(), 'provider' => 'provider-test'));
$this->assertCount(1, $ret);
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
$this->assertGreaterThan(0, $emails['Alchemy\Phrasea\Notification\Mail\MailInfoUserRegistered']);
$this->assertEquals(1, $emails['Alchemy\Phrasea\Notification\Mail\MailRequestEmailConfirmation']);
@@ -1066,7 +1066,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
$this->fail('User not created');
}
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
$this->assertGreaterThan(0, $emails['Alchemy\Phrasea\Notification\Mail\MailInfoUserRegistered']);
$this->assertEquals(1, $emails['Alchemy\Phrasea\Notification\Mail\MailRequestEmailConfirmation']);
@@ -1595,8 +1595,7 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertSame('/prod/', self::$DI['client']->getResponse()->headers->get('location'));
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
public function testAuthenticateProviderCallbackWithRegistrationEnabled()

View File

@@ -164,7 +164,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
$this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates());
$template1->delete();
$template2->delete();
self::$DI['app']['model.user-manager']->delete($template1);
self::$DI['app']['model.user-manager']->delete($template2);
}
}

View File

@@ -86,6 +86,6 @@ class ACLManipulatorTest extends \PhraseanetTestCase
$this->assertEquals(0, $acl->get_limits($acl->get_mask_xor($baseId)));
$this->assertEquals(0, $acl->get_limits($acl->get_mask_and($baseId)));
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
}

View File

@@ -13,11 +13,11 @@ class ACLTest extends \PhraseanetAuthenticatedTestCase
{
$application = new Application('test');
if (null !== $template = self::$DI['app']['manipulator.user']->findByLogin('test_phpunit2')) {
$template->delete();
self::$DI['app']['model.user-manager']->delete($template);
}
if (null !== $template = self::$DI['app']['manipulator.user']->findByLogin('test_phpunit3')) {
$template->delete();
self::$DI['app']['model.user-manager']->delete($template);
}
if (null !== $template = self::$DI['app']['manipulator.user']->findByLogin('test_phpunit3')) {
@@ -105,8 +105,8 @@ class ACLTest extends \PhraseanetAuthenticatedTestCase
$this->assertNull(self::$DI['app']['acl']->get($cobaye)->get_limits($base_id));
}
$template->delete();
$cobaye->delete();
self::$DI['app']['model.user-manager']->delete($template);
self::$DI['app']['model.user-manager']->delete($cobaye);
}
public function testApply_model_with_time_limit()
@@ -143,8 +143,8 @@ class ACLTest extends \PhraseanetAuthenticatedTestCase
$this->assertEquals(array('dmin' => $limit_from, 'dmax' => $limit_to), self::$DI['app']['acl']->get($cobaye)->get_limits($base_id));
}
$template->delete();
$cobaye->delete();
self::$DI['app']['model.user-manager']->delete($template);
self::$DI['app']['model.user-manager']->delete($cobaye);
}
public function testRevoke_access_from_bases()

View File

@@ -40,7 +40,7 @@ class userTest extends \PhraseanetTestCase
self::$DI['app']['EM']->persist($provider);
self::$DI['app']['EM']->flush();
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
$repo = self::$DI['app']['EM']->getRepository('Phraseanet:UsrAuthProvider');
$this->assertNull($repo->findWithProviderAndId('custom-one', 12345));
@@ -134,7 +134,7 @@ class userTest extends \PhraseanetTestCase
private function get_user()
{
if (null !== $user = self::$DI['app']['manipulator.user']->getRepository()->findByLogin('notif_ref_test')) {
$user->delete();
self::$DI['app']['model.user-manager']->delete($user);
}
return self::$DI['app']['manipulator.user']->create('notif_ref_test', mt_rand(), null, false);