public function __construct(Application $app, $force = false) { if ($force) { $this->remove_lock_file(); } if ($this->lock_exists()) { throw new Exception_Setup_UpgradeAlreadyStarted('The upgrade is already started'); } $this->app = $app; $checker = new MailChecker($app['phraseanet.appbox']); if ($checker->hasWrongEmailUsers()) { throw new \Exception_Setup_FixBadEmailAddresses('Please fix the database before starting'); } $this->write_lock(); return $this; }
public function testItHasNoDuplicateEmailUsers() { $checker = new MailChecker(self::$DI['app']['phraseanet.appbox'], 'usr_tmp'); $this->assertFalse($checker->hasWrongEmailUsers()); }