Commit ee3e1ce6 authored by Patrick Barroca's avatar Patrick Barroca 🐧

rel #46014 : fix test failures

parent 3a11804e
......@@ -379,16 +379,22 @@ class Class_Newsletter_DedicatedGroupAssociation extends Storm_Model_Association
$params = ['model_class' => get_class($model),
'model_id' => $model->getId()];
return ($group = Class_UserGroup::findFirstBy($params))
$group = ($group = Class_UserGroup::findFirstBy($params))
? $group
: Class_UserGroup::newInstance(array_merge($params, ['id_cat' => 0]));
: Class_UserGroup::newInstance(array_merge($params, ['id_cat' => 0,
'libelle' => $this->_labelFrom($model)]));
if ((!$model->isNew()) && $group->isNew())
$group->save();
return $group;
}
public function save($model) {
$model
->getDedicatedGroup()
->setLibelle($this->_('Groupe manuel pour la lettre "%s"', $model->getTitre()))
->setLibelle($this->_labelFrom($model))
->save();
}
......@@ -401,4 +407,9 @@ class Class_Newsletter_DedicatedGroupAssociation extends Storm_Model_Association
public function delete($model) {
$model->getDedicatedGroup()->delete();
}
protected function _labelFrom($model) {
return $this->_('Groupe manuel pour la lettre "%s"', $model->getTitre());
}
}
\ No newline at end of file
......@@ -564,8 +564,8 @@ class Admin_NewsletterControllerSendActionTest extends Admin_NewsletterControlle
[
['title', 'Animations'],
['body_text', 'Pour les jeunes
Lien pour se désinscrire de cette lettre d\'information : http://localhost/afi-opac3/newsletter/unsubscribe/newsletter/2/user/%user.id%/hash/%hash%'],
['body_html', 'Pour les jeunes<br/><a href="http://localhost/afi-opac3/newsletter/unsubscribe/newsletter/2/user/%user.id%/hash/%hash%">Je ne veux plus recevoir cette lettre d\'information</a>'],
Lien pour se désinscrire de cette lettre d\'information : '. ROOT_URL . BASE_URL . '/newsletter/unsubscribe/newsletter/2/user/%user.id%/hash/%hash%'],
['body_html', 'Pour les jeunes<br/><a href="'. ROOT_URL . BASE_URL . '/newsletter/unsubscribe/newsletter/2/user/%user.id%/hash/%hash%">Je ne veux plus recevoir cette lettre d\'information</a>'],
['sender', 'bokehrulez@linuxfr.org'],
['created_on', '2016-07-21 11:21:38']
];
......@@ -576,7 +576,7 @@ Lien pour se désinscrire de cette lettre d\'information : http://localhost/afi-
* @test
* @dataProvider dispatchDatas
*/
public function testDispatchTitleShouldBeFoo($name, $expected) {
public function dispatchDataShouldBeCorrect($name, $expected) {
$this->assertEquals($expected, $this->_dispatch->$name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment