diff --git a/VERSIONS_WIP/70266 b/VERSIONS_WIP/70266 new file mode 100644 index 0000000000000000000000000000000000000000..61fd98f9362c2fe3c39213f5cc1d9d1728d6f06a --- /dev/null +++ b/VERSIONS_WIP/70266 @@ -0,0 +1 @@ + - ticket #70266 : Administration : Lettres d'information : Ajout d'une distinction entre le titre (visible dans les boîtes, listes et espace abonné) et le sujet du mail lors de l'envoi \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_386.php b/cosmogramme/sql/patch/patch_386.php new file mode 100644 index 0000000000000000000000000000000000000000..baa9b35cd50de9bff5eff09c8c079e8ddc147d12 --- /dev/null +++ b/cosmogramme/sql/patch/patch_386.php @@ -0,0 +1,4 @@ +<?php +$sql = Zend_Registry::get('sql'); +$sql->query('alter table newsletters add column `mail_subject` varchar(255) default \'\''); +$sql->query('update newsletters set mail_subject=titre'); diff --git a/library/Class/Newsletter.php b/library/Class/Newsletter.php index 21941cec28f6b2b5f7602b8e42cf0c34c75dc324..af19fbe57eb222b5b331835c975c78f17708da0b 100644 --- a/library/Class/Newsletter.php +++ b/library/Class/Newsletter.php @@ -114,6 +114,17 @@ class Class_Newsletter extends Storm_Model_Abstract { 'articles_categories_ids' => '']; + public function validate() { + $this->checkAttribute('titre', + $this->getTitre(), + $this->_('Le titre est obligatoire')); + + $this->checkAttribute('mail_subject', + $this->getMailSubject(), + $this->_('Le sujet du message envoyé est obligatoire')); + } + + public function describeAssociationsOn($associations) { $associations ->add(new Class_Newsletter_DedicatedGroupAssociation('dedicated_group')); @@ -162,6 +173,7 @@ class Class_Newsletter extends Storm_Model_Abstract { $template ->setTitre($this->getTitre()) + ->setSubject($this->getMailSubject()) ->setBodyText($this->_getBodyText($notices, $articles)) ->setBodyHTML($this->_getBodyHTML($notices, $articles)) ->setExpediteur($this->getExpediteur()); diff --git a/library/Class/Newsletter/Dispatch.php b/library/Class/Newsletter/Dispatch.php index 151d7139f9c3c8e9c225f8f25264e41bfd1cdee9..e81dbf69d2638475dae4bc8c792010cd13dc5569 100644 --- a/library/Class/Newsletter/Dispatch.php +++ b/library/Class/Newsletter/Dispatch.php @@ -30,7 +30,7 @@ class Newsletter_DispatchLoader extends Storm_Model_Loader { public function newVolatileFrom($newsletter) { $template = $newsletter->newTemplate(); $model = Class_Newsletter_Dispatch::newInstance(['newsletter' => $newsletter, - 'title' => $template->getTitre(), + 'title' => $template->getSubject(), 'body_text' => $template->getBodyText(), 'body_html' => $template->getBodyHTML(), 'sender' => $template->getExpediteur()]); diff --git a/library/ZendAfi/Form/Admin/Newsletter.php b/library/ZendAfi/Form/Admin/Newsletter.php index f3ec3cd2e6f43cd7b9e8ae6952ecea9cda2f3bd5..9f905bb3f5e9833f3007f514f866e1129d8195b4 100644 --- a/library/ZendAfi/Form/Admin/Newsletter.php +++ b/library/ZendAfi/Form/Admin/Newsletter.php @@ -28,11 +28,17 @@ class ZendAfi_Form_Admin_Newsletter extends ZendAfi_Form { ->setMethod(Zend_Form::METHOD_POST) ->addElement('text', 'titre', - ['label' => $this->_('Titre'), + ['label' => $this->_('Nom de la lettre d\'information'), 'size' => 30, 'required' => true, 'allowEmpty' => false]) + ->addElement('text', 'mail_subject', + ['label' => $this->_('Sujet du message envoyé'), + 'size' => 60, + 'required' => true, + 'allowEmpty' => false]) + ->addElement('email', 'expediteur', ['label' => $this->_('Expéditeur'), 'size' => 30]) @@ -63,7 +69,7 @@ class ZendAfi_Form_Admin_Newsletter extends ZendAfi_Form { 'validators' => [new Zend_Validate_Int()]]) - ->addDisplayGroup(['titre', 'expediteur', 'draft'], + ->addDisplayGroup(['titre', 'mail_subject', 'expediteur', 'draft'], 'letter', ['legend' => $this->_('Lettre')]) diff --git a/tests/application/modules/admin/controllers/NewsletterControllerTest.php b/tests/application/modules/admin/controllers/NewsletterControllerTest.php index dcb3871bd70b2b629dfeed4b0e2ab6d87b446106..e6b82973e5573f77bb2313de437e137221947434 100644 --- a/tests/application/modules/admin/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/admin/controllers/NewsletterControllerTest.php @@ -235,27 +235,49 @@ class Admin_NewsletterControllerAddActionTest extends Admin_NewsletterController } + /** @test */ public function testAddActionFound() { $this->assertController('newsletter'); $this->assertAction('add'); } + /** @test */ public function testFormTitreIsEmpty() { $this->assertXPath("//form//input[@id='titre'][@value='']"); } + /** @test */ + public function LabelForTitreShouldBeNomdeLaLettre() { + $this->assertXPathContentContains("//form//label[@for='titre']", 'Nom de la lettre d\'information'); + } + + + /** @test */ + public function FormShouldContainsInputMailSubjectRequiredWithEmptyValue() { + $this->assertXPath("//form//input[@id='mail_subject'][@required='required'][@value='']"); + } + + + /** @test */ + public function LabelForMailSubjectShouldBeSujetDuMessageEnvoye() { + $this->assertXPathContentContains("//form//label[@for='mail_subject']", 'Sujet du message envoyé'); + } + + /** @test */ public function testFormContenu() { $this->assertQuery("form textarea[@name='contenu']"); } + /** @test */ public function testTitle() { $this->assertQueryContentContains("h1", "Créer une lettre d'information"); } + /** @test */ public function testSubmitButton() { $this->assertXPath("//div//button[contains(@onclick,\"submit()\")]"); } @@ -314,6 +336,7 @@ class Admin_NewsletterControllerEditActionTest extends Admin_NewsletterControlle $this->fixture('Class_Newsletter', ['id' => 53, 'titre' => 'Nouveautés', + 'mail_subject' => 'Nouveautés', 'contenu'=>'Notre sélection du mois', 'expediteur' => 'laurent@free.fr', 'articles_ids' => '6-42', @@ -385,6 +408,7 @@ class Admin_NewsletterControllerAddActionPostTest extends Admin_NewsletterContro parent::setUp(); $data = ['titre' => 'Fêtes du lac', + 'mail_subject' => 'Une nouvelle animation : fêtes du lac', 'contenu' => 'Plein les yeux', 'id_catalogue' => '', 'id_panier' => '', @@ -468,7 +492,9 @@ class Admin_NewsletterControllerDeleteActionTest extends Admin_AbstractControlle public function setUp() { parent::setUp(); - $this->fixture('Class_Newsletter', ['id' => 4]); + $this->fixture('Class_Newsletter', ['id' => 4, + 'titre'=>'montitre', + 'mail_subject'=>'monsujet']); $this->fixture('Class_Newsletter_Blacklist', ['id' => 42, 'newsletter_id' => 4, @@ -893,6 +919,7 @@ abstract class Admin_NewsletterControllerPreviewActionTestCase $nouveautes = $this->fixture('Class_Newsletter', ['id' => 3, 'titre' => 'Nouveautés', + 'mail_subject' => 'Nouveautés', 'contenu' => 'Notre sélection du mois<img src="zork.jpg"/> <b>Hoho</b>', 'id_catalogue' => 1, 'nb_notices' => 0, @@ -1100,6 +1127,7 @@ class Admin_NewsletterControllerWithoutExpediteurSendTestActionTest extends Admi $nouveautes ->setId(3) ->setTitre('Nouveautés') + ->setMailSubject('Nouveautés') ->setContenu('Notre sélection du mois') ->setLastDistributionDate('2013-01-01') ->setExpediteur(null); @@ -1127,6 +1155,7 @@ class Admin_NewsletterControllerPostSendTestActionTest extends Admin_AbstractCon $this->nouveautes = $this->fixture('Class_Newsletter', ['id' => 4, 'titre' => 'nouveautés', + 'mail_subject' => 'nouveautés', 'last_distribution_date' => '2016-09-26', 'id_panier' => 0, 'id_catalogue' => 0, @@ -1192,6 +1221,7 @@ abstract class Admin_NewsletterControllerEditSubcsribersTestCase extends Admin_A $this->_nl_nouveautes = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés', + 'mail_subject' => 'nouveautés', 'last_distribution_date' => '2013-09-23', 'user_groups' => [$this->fixture('Class_UserGroup', ['id' => 23, @@ -1619,6 +1649,7 @@ class Admin_NewsletterControllerScriptTest extends Admin_NewsletterControllerTes $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Nouveautés', + 'mail_subject' => 'nouveautés', 'contenu'=>'Notre sélection du mois', 'expediteur' => 'laurent@free.fr']); @@ -1628,6 +1659,7 @@ class Admin_NewsletterControllerScriptTest extends Admin_NewsletterControllerTes $this->fixture('Class_Newsletter', ['id' => 6, 'titre' => 'Nouveautés', + 'mail_subject' => 'nouveautés', 'contenu'=>'Notre sélection du mois', 'expediteur' => 'laurent@free.fr']); @@ -1756,15 +1788,14 @@ class Admin_NewsletterControllerSendProgressWithErrorAnd1Of2SentTest $this->assertContains('envoyé à 1 sur 2', $this->_json->status); } - /** @test */ + + /** @test */ public function sendButtonShouldContainsReloadText() { - Class_Newsletter::find(1)->setTitre('Other title')->save(); + Class_Newsletter::find(1)->setTitre('Other title')->assertSave(); $this->dispatch('admin/newsletter/index', true); - $this->assertXPath('//a[contains(@onclick,"Reprendre l\\\'envoi de la lettre d\\\'information: Nouveautés classique ? ")]', $this->_response->getBody()); + $this->assertXPath('//a[contains(@onclick,"Reprendre l\\\'envoi de la lettre d\\\'information: Nouveautés classieuses ? ")]', $this->_response->getBody()); $this->assertXPath('//img[contains(@title,"Reprendre l\'envoi en cours")]', $this->_response->getBody()); } - - } @@ -1823,6 +1854,7 @@ class Admin_NewsletterControllerDuplicateActionTest $newsletter = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Nouveautés Classieuses', 'contenu' => 'Notre sélection du mois', 'user_groups' => [$my_group]]); diff --git a/tests/application/modules/admin/controllers/UrlManagerControllerTest.php b/tests/application/modules/admin/controllers/UrlManagerControllerTest.php index eef5d11f77c8d0e7cea9b60fdee00b33d6c733b4..5d36844deae5e746106bb66e2776b36f1ed58a44 100644 --- a/tests/application/modules/admin/controllers/UrlManagerControllerTest.php +++ b/tests/application/modules/admin/controllers/UrlManagerControllerTest.php @@ -88,6 +88,7 @@ abstract class UrlManagerTestCase extends Admin_AbstractControllerTestCase { $this->fixture('Class_Newsletter', ['id' => 45, 'titre' => 'Les nouveautés', + 'mail_subject' => 'nouveautés', 'contenu' => 'test de newsletter: http://monurl.newsletter.fr. http://mon-domain.org']); $this->fixture('Class_Catalogue', diff --git a/tests/application/modules/opac/controllers/AbonneControllerNewslettersTest.php b/tests/application/modules/opac/controllers/AbonneControllerNewslettersTest.php index 06789ff79f94f373aaae47073b3f47d96bdbda5e..9d26cdbd28fa02755ed55b3ef7333a9aa771ef06 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerNewslettersTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerNewslettersTest.php @@ -61,11 +61,13 @@ abstract class AbonneControllerWithTwoNewslettersTestCase extends AbstractAbonne $this->concerts = $this->fixture('Class_Newsletter', ['id' => 12, 'titre' =>'Concerts', + 'mail_subject' => 'Concerts', 'contenu' => 'Festival jazz']); $this->visites = $this->fixture('Class_Newsletter', ['id' => 14, 'titre' =>'Visites', + 'mail_subject' => 'Visites', 'contenu' => 'du patrimoine']); @@ -209,6 +211,7 @@ class AbonneControllerNewslettersEditActionTest extends AbonneControllerWithTwoN $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'hidden newsletter', + 'mail_subject' => 'hidden newsletter', 'draft' => true]); diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index abc08971fdf529e5a1c5aec8b589f9d9031c7b20..a5255b0d3c107ffa26b26e7f0f77ed417e4a94be 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -2051,6 +2051,7 @@ class AuthControllerNewsletterRegisterKickSpamBotsTest extends AuthControllerNob parent::setUp(); $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', [ @@ -2074,6 +2075,7 @@ class AuthControllerNobodyLoggedAndRegisterNewsletterTest extends AuthController parent::setUp(); $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', 'titre' => 'Daily News']); $this->dispatch('/opac/auth/newsletter-register/id/5', true); @@ -2124,7 +2126,9 @@ class AuthControllerPostRegisterNewsletterDailyNewsTest extends AuthControllerNo Class_Profil::getCurrentProfil() ->setMailSite('tom@afi.fr'); - $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); + $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', + 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'iwanttobespamed@abo.bzh', 'website' => '']); @@ -2227,6 +2231,7 @@ class AuthControllerPostRegisterNewsletterDailyNewsWithNonUniqueMailTest extends $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', [ @@ -2256,7 +2261,9 @@ class AuthControllerPostRegisterNewsletterDailyNewsWithBadMailTest extends AuthC public function setUp() { parent::setUp(); - $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); + $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', + 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'bad_mail!', 'website' => '']); @@ -2309,6 +2316,7 @@ class AuthControllerNewsletterActiveUserWithWrongParamsTest extends AuthControll public function wrongKeyShouldDisplayExpectedMessage() { $this->fixture('Class_Newsletter', ['id' => 1, + 'mail_subject' => 'Nouvelles du front', 'titre' => 'News of the month']); $this->dispatch('opac/auth/newsletter-active-user/c/4897sd8fsdf/id/1', true); @@ -2381,6 +2389,7 @@ class AuthControllerTomLoggedRegisterNewsletterTestCase extends AbstractControll $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily news', 'titre' => 'Daily News']); (new NewsletterFixtures())->createUsersAndNewsletter($this); @@ -2422,6 +2431,7 @@ class AuthControllerNewsletterUnsubscribeNoBodyTest extends AuthControllerNobody $this->fixture('Class_Newsletter', ['id' => 10, + 'mail_subject' => 'Daily News', 'titre' => 'Daily News']); @@ -2518,7 +2528,9 @@ class AuthControllerNewsletterRegisterSendMailWrongMailConfigurationTest extends Class_Profil::getCurrentProfil() ->setMailSite('tom@afi.fr'); - $this->fixture('Class_Newsletter', ['id' => 5, 'titre' => 'Daily News']); + $this->fixture('Class_Newsletter', ['id' => 5, + 'mail_subject' => 'Daily News', + 'titre' => 'Daily News']); $this->postDispatch('/opac/auth/newsletter-register/id/5', ['email' => 'iwanttobespamed@abo.it', 'website' => '']); diff --git a/tests/application/modules/opac/controllers/NewsletterControllerTest.php b/tests/application/modules/opac/controllers/NewsletterControllerTest.php index 892b5b86ad5b7c47efa0cf68f325cd3925b0b252..3f3341d9615efb7f5256873bd00ab5297eed6513 100644 --- a/tests/application/modules/opac/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/opac/controllers/NewsletterControllerTest.php @@ -48,6 +48,7 @@ abstract class NewsletterControllerTestCase extends AbstractControllerTestCase { $this->_newsletter = $this->fixture('Class_Newsletter', ['id' => 34, + 'mail_subject' => 'Dernieres nouvelles', 'titre' => 'Last news']); Class_UserGroup::setMemoryCleaner(function() {}); diff --git a/tests/db/UpgradeDBTest.php b/tests/db/UpgradeDBTest.php index cb0c142ceb1d7691ce9a671d376f841aa370c3eb..f45761c0532c87667aaea93e630b6906101c9b67 100644 --- a/tests/db/UpgradeDBTest.php +++ b/tests/db/UpgradeDBTest.php @@ -213,6 +213,7 @@ abstract class UpgradeDBTestCase extends PHPUnit_Framework_TestCase { protected function assertField($table, $column, $expected, $field, $message = '') { + $fields = []; try { foreach($this->query(sprintf('show fields from `%s` where field=\'%s\'', $table, $column))->fetchAll() as $row @@ -3182,5 +3183,34 @@ class UpgradeDB_385_Test extends UpgradeDBTestCase { public function identitiesUserIdShouldBeIndexed() { $this->assertIndex('user_identities', 'user_id'); } - } + + + + +class UpgradeDB_386_Test extends UpgradeDBTestCase { + public function prepare() { + $this->silentQuery('alter table newsletters drop column mail_subject'); + $this->silentQuery("insert into newsletters (titre, contenu, id_catalogue, id_panier, nb_notices, auto_subscribe) values ('db testing', '', 0, 0, 0, 0)"); + } + + + public function tearDown() { + $this->silentQuery("delete from newsletters where titre='db testing'"); + parent::tearDown(); + } + + + /** @test */ + public function newslettersShouldContainsFieldMailSubject() { + $this->assertFieldType('newsletters', 'mail_subject', 'varchar(255)'); + } + + + /** @test */ + public function newslettersMailSubjectShouldDefaultToTitle() { + $this->assertEquals('db testing', + current($this->query("select mail_subject from newsletters where titre='db testing'") + ->fetch())); + } +} \ No newline at end of file diff --git a/tests/fixtures/NewsletterFixtures.php b/tests/fixtures/NewsletterFixtures.php index 2e4aabc8e17aaf6ce3cc481b4db7f319b69b14ab..c8567bf85d11c3d88c63881bed26f2baa91f0013 100644 --- a/tests/fixtures/NewsletterFixtures.php +++ b/tests/fixtures/NewsletterFixtures.php @@ -72,6 +72,7 @@ class NewsletterFixtures { $controller->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Nouveautés classieuses', 'contenu' => 'Notre sélection du mois', 'id_catalogue' => '', 'id_panier' => '', @@ -82,6 +83,7 @@ class NewsletterFixtures { $controller->fixture('Class_Newsletter', ['id' => 2, 'titre' => 'Animations', + 'mail_subject' => 'Animations', 'contenu' => 'Pour les jeunes', 'last_distribution_date' => null, 'id_catalogue' => '', diff --git a/tests/library/Class/Migration/NewsletterSubscriptionTest.php b/tests/library/Class/Migration/NewsletterSubscriptionTest.php index b8cf8aa204fdd6329bf01de32efc895dbda65f91..c3034c8086d8b3db09ffbf759b0031c261ada8fe 100644 --- a/tests/library/Class/Migration/NewsletterSubscriptionTest.php +++ b/tests/library/Class/Migration/NewsletterSubscriptionTest.php @@ -58,6 +58,7 @@ class Class_Migration_NewsletterSubscriptionSimpleTest extends Class_Migration_N $this->classique = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Classique : Notre sélection du mois', 'contenu' => 'Notre sélection du mois', 'id_catalogue' => '', 'auto_subscribe' => 0, @@ -99,6 +100,7 @@ class Class_Migration_NewsletterSubscriptionWithGuestTest extends Class_Migratio $this->classique = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Classique : Notre sélection du mois', 'contenu' => 'Notre sélection du mois', 'id_catalogue' => '', 'id_panier' => '', diff --git a/tests/library/Class/NewsletterDispatchTest.php b/tests/library/Class/NewsletterDispatchTest.php index 8def6559768c384be9b32dd8d45d8784fc4c0327..2bde3a3cc8ba741d75f97d709a0ce6d6bed1c346 100644 --- a/tests/library/Class/NewsletterDispatchTest.php +++ b/tests/library/Class/NewsletterDispatchTest.php @@ -61,6 +61,7 @@ abstract class Class_NewsletterDispatchTestCase extends ModelTestCase { $newsletter = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Nouveautés classieuses', 'contenu' => 'Notre sélection du mois', 'id_catalogue' => '', 'id_panier' => '', diff --git a/tests/library/Class/NewsletterMailingTest.php b/tests/library/Class/NewsletterMailingTest.php index 841fd9c562b82b8b1d3ff0806bd46e1c0256fa8a..404bc49ce788d45cfc981a4c1e7992d3051153a4 100644 --- a/tests/library/Class/NewsletterMailingTest.php +++ b/tests/library/Class/NewsletterMailingTest.php @@ -100,6 +100,7 @@ abstract class NewsletterMailingTestCase extends ModelTestCase { $this->animations = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Animations du mois', + 'mail_subject' => 'Nos propositions du mois', 'contenu' => 'Découverte des cuisines du monde', 'id_panier' => 23, 'id_catalogue' => null, @@ -205,7 +206,7 @@ class NewsletterMailingAnimationsSendMailTest extends NewsletterMailingTestCase /** @test */ public function subjectShouldBeAnimationsDuMois() { - $this->assertEquals('Animations du mois', $this->mails[0]->getSubject()); + $this->assertEquals('Nos propositions du mois', $this->mails[0]->getSubject()); } @@ -464,6 +465,7 @@ class NewsletterMailingDedupTest extends ModelTestCase { $this->_letter = $this->fixture('Class_Newsletter', ['id' => 23, 'titre' => 'Alerte vega', + 'mail_subject' => 'Attention', 'id_panier' => 0, 'id_catalogue' => 0, 'expediteur' => 'professeur@centre-de-recherche.fr', @@ -558,6 +560,7 @@ class NewsletterMailingRecordAbsoluteUrlTest extends ModelTestCase { $this->_letter = $this->fixture('Class_Newsletter', ['id' => 23, 'titre' => 'Alerte vega', + 'mail_subject' => 'notification', 'id_panier' => 1, 'nb_notices' => 50, 'id_catalogue' => 0, diff --git a/tests/library/Class/NewsletterTest.php b/tests/library/Class/NewsletterTest.php index 35e0c754c1d279cf09c5c5d6d302addae9fb7bd9..6ce28eb7b03dd7bcdd721d4109feabbbd2155513 100644 --- a/tests/library/Class/NewsletterTest.php +++ b/tests/library/Class/NewsletterTest.php @@ -25,11 +25,13 @@ abstract class NewsletterTestCase extends ModelTestCase { $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'Nouveautés classique', + 'mail_subject' => 'Nouveautés Classieuses', 'contenu' => 'Notre sélection du mois']); $this->fixture('Class_Newsletter', ['id' => 2, 'titre' => 'Animations', + 'mail_subject' => 'animations', 'contenu' => 'Pour les jeunes']); } } @@ -86,6 +88,7 @@ class NewsletterTimeSourceTest extends NewsletterTestCase { $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'news of the month', + 'mail_subject'=>'Nouvelles du front', 'contenu' => 'Eruopeen election ', 'last_distribution_date' => '']); $this->newsletter = Class_Newsletter::find(1); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/NewslettersTest.php b/tests/library/ZendAfi/View/Helper/Accueil/NewslettersTest.php index 7942305318096a040a0d7380031d392d4223056a..46baa785dae86fb634ebdc14bd732cdd6d9360e2 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/NewslettersTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/NewslettersTest.php @@ -55,11 +55,14 @@ class NewslettersWithConnectedUserTest extends NewslettersViewHelperTestCase { $nouveautes_musique = $this->fixture('Class_Newsletter', ['id' => 2, + 'mail_subject' => 'News', 'titre' => 'Nouveautes Musique']); $user->setNewsletters([$nouveautes_musique]); - $this->fixture('Class_Newsletter', ['id' => 3, 'titre' =>'Animations']); + $this->fixture('Class_Newsletter', ['id' => 3, + 'titre' => 'Animations', + 'mail_subject' => 'Animations']); $mock = $this->mock() ->whenCalled('fetchAll') @@ -150,6 +153,7 @@ class NewslettersWithNonConnectedUserTest extends NewslettersViewHelperTestCase $this->fixture('Class_Newsletter', ['id' => 1, + 'mail_subject'=> 'News of the month', 'titre' => 'News of the month']); $this->html = $this->_helper->getBoite(); @@ -190,10 +194,12 @@ class NewslettersWithConnectedUserAndHiddenNewsletterTest $this->fixture('Class_Newsletter', ['id' => 2, 'titre' =>'Nouveautes musique', + 'mail_subject' => 'Nouveautés musique', 'draft' => 0]); $this->fixture('Class_Newsletter', ['id' => 3, 'titre' =>'Nouveautes classique', + 'mail_subject' =>'Nouveautes classique', 'draft' => 1]); $this->html = $this->_helper->getBoite(); diff --git a/tests/library/ZendAfi/View/Helper/TagProgressBarForNewsletterTest.php b/tests/library/ZendAfi/View/Helper/TagProgressBarForNewsletterTest.php index 8c6fc27a687c7e7bca88bd23d4b41839a4050d41..b64645c499849f1e8a48c9049d35318fc3ec7aae 100644 --- a/tests/library/ZendAfi/View/Helper/TagProgressBarForNewsletterTest.php +++ b/tests/library/ZendAfi/View/Helper/TagProgressBarForNewsletterTest.php @@ -29,18 +29,21 @@ class ZendAfi_View_Helper_TagProgressBarForNewsletterTest extends ViewHelperTest $this->newsletter = $this->fixture('Class_Newsletter', ['id' => 1, 'titre' => 'News', + 'mail_subject' => 'News', 'contenu' => 'content', 'last_distribution_date' => null]); $this->second_newsletter = $this->fixture('Class_Newsletter', ['id' => 2, 'titre' => 'News', + 'mail_subject' => 'News', 'contenu' => 'content', 'last_distribution_date' => '2014-5-28 10:00:00']); $this->third_newsletter = $this->fixture('Class_Newsletter', ['id' => 3, 'titre' => 'News', + 'mail_subject' => 'News', 'contenu' => 'content', 'last_distribution_date' => '2014-5-28 10:00:00']); diff --git a/tests/scenarios/Manager/ManagerTest.php b/tests/scenarios/Manager/ManagerTest.php index 47836055925e473c8f2268c369ac6710baa0b1af..2af2acbac1f253dc9a3ffb7e2a9806dcc3176db7 100644 --- a/tests/scenarios/Manager/ManagerTest.php +++ b/tests/scenarios/Manager/ManagerTest.php @@ -380,7 +380,8 @@ class ManagerHeaderActionsTest extends Admin_AbstractControllerTestCase { $this->fixture('Class_Newsletter', ['id' => 3, - 'titre' => 'Framasoft']); + 'titre' => 'Framasoft', + 'mail_subject'=>'Framasoft']); $this->dispatch('/admin/newsletter/edit/id/3', true); diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 03bf00ec929d5aed790b74a7e972feced97e011b..cb80c73ed29b2b766bcfff961338483b2072b9b3 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -704,6 +704,10 @@ class TemplatesBreadcrumbTestDispatchSearchTest extends TemplatesIntonationTestC ->setNewDatas(['IntonationVisibilityAbonne' => 1]) ->updateProfile(); + $this->fixture('Class_Newsletter',['id'=>54, + 'titre' => 'nouveautés', + 'contenu' => 'test', + 'mail_subject' => 'nouveautés']); $this->dispatch('/opac/abonne/fiche/id_profil/72', true); } @@ -3133,6 +3137,7 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes $newsletter = $this->fixture('Class_Newsletter', ['id' => 45, 'titre' => 'Les nouveautés', + 'mail_subject' => 'nouveautés', 'contenu' => 'test de newsletter: http://monurl.newsletter.fr. http://mon-domain.org']); $current_user->setNewsletters([$newsletter]); @@ -4744,6 +4749,7 @@ class TemplatesDispatchNewsletterWidgetTest extends TemplatesIntonationTestCase $this->fixture('Class_Newsletter', ['id' => 3, 'titre' => 'Jeunesse', + 'mail_subject' => 'Jeunesse', 'contenu' => 'les nouveautés jeunesse']); $this->dispatch('/opac/index/index/id_profil/72', true);