mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix unit tests
This commit is contained in:
@@ -183,7 +183,7 @@ class Dashboard implements ControllerProviderInterface
|
||||
$app->abort(400, 'Bad request missing email parameter');
|
||||
};
|
||||
|
||||
if (\Swift_Validate::email($request->request->get('email'))) {
|
||||
if (!\Swift_Validate::email($request->request->get('email'))) {
|
||||
$app->abort(400, 'Bad request missing email parameter');
|
||||
};
|
||||
|
||||
|
@@ -309,6 +309,8 @@ class Account implements ControllerProviderInterface
|
||||
$mail->setButtonUrl($url);
|
||||
$mail->setExpiration($date);
|
||||
|
||||
$app['notification.deliverer']->deliver($mail);
|
||||
|
||||
return $app->redirect('/account/reset-email/?update=mail-send');
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ class caption_Field_Value implements cache_cacheableInterface
|
||||
$this->VocabularyId = $datas['vocabularyId'];
|
||||
|
||||
return $this;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -57,13 +57,27 @@ class AdminDashboardTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->mockNotificationDeliverer('Alchemy\Phrasea\Notification\Mail\MailTest');
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/dashboard/send-mail-test/', array(
|
||||
'email' => self::$DI['user']->get_email()
|
||||
'email' => 'user-test@phraseanet.com'
|
||||
));
|
||||
|
||||
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
|
||||
$this->assertRegexp('/email=/', self::$DI['client']->getResponse()->headers->get('location'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Dashboard::sendMail
|
||||
*/
|
||||
public function testSendMailTestWithWrongMail()
|
||||
{
|
||||
$this->setAdmin(true);
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/dashboard/send-mail-test/', array(
|
||||
'email' => 'user-test-phraseanet.com'
|
||||
));
|
||||
|
||||
$this->assertEquals(400, self::$DI['client']->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Alchemy\Phrasea\Controller\Admin\Dashboard::sendMail
|
||||
*/
|
||||
|
@@ -181,7 +181,7 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$response = self::$DI['client']->getResponse();
|
||||
|
||||
$this->assertTrue($response->isRedirect());
|
||||
$this->assertEquals('/login/forgot-password/?error=invalidmail', $response->headers->get('location'));
|
||||
$this->assertEquals('/login/forgot-password/?error=noaccount', $response->headers->get('location'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user