Skip to content
Snippets Groups Projects
AuthenticationIntentTest.php 24.9 KiB
Newer Older
<?php
/**
 * Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved.
 *
 * BOKEH is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation.
 *
 * There are special exceptions to the terms and conditions of the AGPL as it
 * is applied to this software (see README file).
 *
 * BOKEH is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with BOKEH; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 */


abstract class AuthenticationIntentWithoutLoginWidgetTestCase extends AbstractControllerTestCase {
  protected string $_url_tested;
  public function setUp() {
    parent::setUp();

    ZendAfi_Auth::getInstance()->clearIdentity();

    $this->_buildTemplateProfil(['id' => 1]);

    $profile = $this->_buildTemplateProfil(['id' => 3,
                                            'libelle' => 'Authentication Page',
                                            'parent_id' => 1,
                                            'intent' => 'authentication']);

    $profile_patcher = (new Class_Template_ProfilePatcher(null))
      ->setProfile($profile);

    $profile_patcher
      ->addWidget(Intonation_Library_Widget_Login_Definition::CODE,
                  Class_Profil::DIV_MAIN);

    $this->fixture(Class_Notice::class,
                   ['id' => 2]);

    $this->fixture(Class_Exemplaire::class,
                   ['id' => 1,
                    'id_notice' => 2,
                    'id_origine' => '12',
                    'code_barres' => '1249036',
                    'id_int_bib' => 1,
                    'id_bib' => 1]);

    $this->fixture(Class_IntBib::class,
                   ['id' => 1,
                    'label' => 'majolieville',
                    'comm_sigb' => Class_IntBib::COM_KOHA,
                    'comm_params' => ['url_serveur' => 'https://monsuperkoha.org']]);

    $this->fixture(Class_Bib::class,
                   ['id' => 1,
                    'libelle' => 'Montmin']);

    $this->fixture(Class_Newsletter::class,
                   ['id' => 35,
                    'titre' => 'Jeunesse',
                    'mail_subject' => 'Jeunesse'
                   ]);

    $this->fixture(Class_Notice::class,
                   ['id' => 123,
                    'titre' => 'Le parfum de la dame en noir',
                    'type_doc' => Class_TypeDoc::LIVRE
                   ]);

    $this->fixture(Class_Exemplaire::class,
                   ['id' => 1234,
                    'id_int_bib' => 1,
                    'id_bib' => 1,
                    'notice_id' => 123,
                    'cote' => 'BAC123',
                    'code_barres' => '1234'
                   ]);
  }
}




class AuthenticationIntentWithoutLoginViewAlbumTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase{

  public function setUp() {
    parent::setUp();

    $this->fixture(Class_Album::class,
                   ['id' => 4,
                    'notice_id' => 3,
                    'type_doc_id' => 'ArteVod',
                    'titre' => 'Seventh Son of a Seventh Son',
                    'status' => Class_Album::STATUS_VALIDATED]);

    $this->fixture(Class_Exemplaire::class,
                   ['id' => 15,
                    'notice' => $this->fixture(Class_Notice::class,
                                               ['id' => 3,
                                                'titre' => 'Un titre',
                                                'type_doc' => 'ArteVod']),
                    'id_origine' => 4,
                    'code_barres' => '786876786']);

    $this->fixture(Class_AlbumRessource::class,
                   ['id' => 1,
                    'id_album' => 4,
                    'titre' => 'Moonchild',
                    'url' => 'http://mabib.net/bib-numerique/notice/ido/1']);

    $this->dispatch('/noticeajax/resources/id/3');
  }


  /** @test */
  public function albumShouldContainAuthenticationLink() {
    $this->assertXPathContentContains('//a[contains(@href,"/modules/arte-vod/album_id/4")][@target = "_blank"]',
                                      Class_CharSet::fromISOtoUTF8('Visionner le film dans son intégralité'));
class AuthenticationIntentWithoutLoginRecordReviewsClefTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase{

  public function setUp() {
    parent::setUp();
    $this->dispatch('record/reviews/clef/qsdfqsdf/id/2');
  }


  /** @test */
  public function seConnecterLinkShouldBeProfileIdThree() {
    $this->assertXPathContentContains('//div//a[@href="/index/index/id_profil/3/redirect_url/'
                                      . urlencode('/record/reviews/clef/qsdfqsdf/id/2') . '"]',
class AuthenticationIntentWithoutLoginRecord2LinksTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();

    $this->fixture(Class_Notice::class,
                   ['id' => 2,
                    'clef_oeuvre' => 'PSYKO',
                    'titre_principal' => 'Psyko'
                   ]);

    $this->dispatch('recherche/viewnotice/id/2');
  }


  /** @test */
  public function mesPreferesLinkShouldBeIndexIndexIdProfile() {
    $this->assertXPathContentContains('//a[contains(@href,"/abonne/ajouter-le-document-a-la-selection/selection_label/Mes+pr%C3%A9f%C3%A9r%C3%A9s/image/like/revert-image/dislike/record_id/2/ajax/")]',
                                      'Mes préférés');
  }


  /** @test */
  public function dejaLuLinkShouldBeIndexIndexIdProfile() {
    $this->assertXPathContentContains('//a[contains(@href,"/abonne/ajouter-le-document-a-la-selection/")]',
                                      'Déjà lu');
  }


  /** @test */
  public function seConnecterAvisLinkShouldBeindex() {
    $this->assertXPathContentContains('//a[contains(@href,"/index/index/id_profil/3/redirect_url/'.urlencode('/recherche/viewnotice/id/2').'")][@title="Connectez vous pour donner un avis"]',"Se connecter");
  }
}




class AuthenticationIntentWithoutLoginRechercheSimpleLinksTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();

    $this->fixture(Class_Notice::class,
                   ['id' => 2,
                    'clef_oeuvre' => 'PSYKO',
                    'titre_principal' => 'Psyko',
                    'titres' => 'PSYKO',
                    'type' => 1]);

    Class_AdminVar::set('ENABLE_SEARCH_MULTIPLE_RECORD_SELECTION', 1);
    Zend_Registry::get('session')->search_record_selection = [2];

    $this->dispatch('recherche/simple/expressionRecherche/Psyko');
  }


  /** @test */
  public function suivreLinkShouldBeBookmarkedSearchesAdd() {
    $this->assertXPathContentContains('//a[contains(@href,"/bookmarked-searches/add/expressionRecherche/Psyko/label/R%C3%A9sultat+pour+Psyko+")]',
                                      "Suivre");
  }


  /** @test */
  public function addPanierLinkShouldBePanierAddSelection() {
    $this->assertXPathContentContains('//div[@class="record-selection"]//a[contains(@href,"/panier/add-selection")][@title="Ajouter toutes les notices de la sélection à un panier"]',
                                      "Mettre dans un panier");
  }
}




abstract class AuthenticationIntentWithoutLoginDispatchTestCase
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  protected string $_url_tested;
  public function setUp() {
    parent::setUp();
    $this->_setReferer() ;
    $this->dispatch($this->_url_tested);
  }


  public function tearDown(){
    $_SERVER['HTTP_REFERER'] = null;
    parent::tearDown();
  }


  protected function _setReferer(){
    $_SERVER['HTTP_REFERER'] = '/recherche/viewnotice/id/12';
  }


  /** @test */
  public function pageShouldRedirectToAuthenticationPage() {
    $this->assertRedirectTo('/index/index/id_profil/3/redirect_url/'
                            .urlencode($_SERVER['HTTP_REFERER'])
                            .'/after_login_do/'
                            .urlencode($this->_url_tested));
  }
}





class AuthenticationIntentWithoutLoginNoticeAjaxAddAvisTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested =  '/noticeajax/add-avis/id/2';
}




class AuthenticationIntentWithoutLoginNoticeAjaxAddTagTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested =  '/noticeajax/add-tag/id/2';
}




class AuthenticationIntentWithoutLoginRechercheConsultationPickupAjaxTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested =  '/recherche/consultation-pickup-ajax/id/2';
}




class AuthenticationIntentWithoutLoginPanierAddSelectionTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested =  '/panier/add-selection/id/2';
}




class AuthenticationIntentWithoutLoginPanierAddRecordAjaxTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested =  '/panier/add-record-ajax/id/2';
}




class AuthenticationIntentRechercheReserverRedirectToLoginTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {
  protected string $_url_tested = '/recherche/reservation/id_int_bib/1/id_bib/1/id_notice/123/cote/BAC123';
  protected string $_referer = '/record/items/123';
}




class AuthenticationIntentDispatchAbonneInscrireSessionTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested = '/abonne/inscrire-session/id/1';
}





class AuthenticationIntentDispatchAbonneSuggestionAchatAddTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested = '/abonne/suggestion-achat-add/id/1';
}




class AuthenticationIntentDispatchAbonneFicheId1AddTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested = '/abonne/fiche/id/1';
}




class AuthenticationIntentDispatchAbonneConfigurationsAddTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested = '/abonne/configurations';
}




class AuthenticationIntentDispatchBookmarkedSearchesTest
  extends AuthenticationIntentWithoutLoginDispatchTestCase {

  protected string $_url_tested = '/bookmarked-searches/add/label/qsdf/id/1';
}




abstract class AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  protected string $_url_tested;
  public function setUp() {
    parent::setUp();
    $this->dispatch($this->_url_tested);
  }


  /** @test */
  public function pageShouldRedirectToAuthenticationPage() {
    $this->assertRedirectTo('/index/index/id_profil/3/redirect_url/'
                            . urlencode($this->_url_tested));
class AuthenticationIntentBibNumeriqueControllerConsultBookOpenAjaxTest
  extends AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase {

  protected string $_url_tested =  '/bib-numerique/consult-book-open-ajax/id/2';
}




class AuthenticationIntentBibNumeriqueControllerConsultBookAjaxTest
  extends AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase {

  protected string $_url_tested =  '/bib-numerique/consult-book-ajax/id/2';
}




class AuthenticationIntentBibNumeriqueControllerConsultBookTest
  extends AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase {

  protected string $_url_tested =  '/bib-numerique/consult-book/id/2';
}




class AuthenticationIntentBibNumeriqueControllerLoanBookAjaxTest
  extends AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase {

  protected string $_url_tested =  '/bib-numerique/loan-book-ajax/id/2';
}




class AuthenticationIntentBibNumeriqueControllerDownloadBookAjaxTest
  extends AuthenticationIntentWithoutLoginBibNumeriqueDispatchTestCase {

  protected string $_url_tested =  '/bib-numerique/download-loan-book-ajax/id/2';
}




class AuthenticationIntentDispatchWithAfterLoginRedirectAndConnectionWithUserTest
  extends AbstractControllerTestCase {

  public function setUp() {
    parent::setUp();

    $this->_buildTemplateProfil(['id' => 1,
                                 'libelle' => 'accueil']);

    $this->_buildTemplateProfil(['id' => 3,
                                 'libelle' => 'auth',
                                 'parent_id' => 1,
                                 'intent' => 'authentication']);
    $this->fixture(Class_Users::class,
                   ['id' => 36,
                    'login' => 'pourlecoup',
                    'password' => 'puocelruop']);


    $authenticated = false;
    Zend_Registry::get('session')->redirect_url = "/recherche/viewnotice/id/2";
    ZendAfi_Auth::setInstance($this->mock()
                              ->whenCalled('getIdentity')
                              ->willDo(
                                       function() use(&$authenticated) {
                                         if (!$authenticated)
                                           return null;

                                         $identity = new StdClass();
                                         $identity->ID_USER = 36;
                                         return $identity;
                                       })
                              ->whenCalled('authenticateLoginPassword')
                              ->with('pourlecoup', 'puocelruop')
                              ->willDo(
                                       function() use(&$authenticated) {
                                         return $authenticated = true;
                                       })
                              ->whenCalled('authenticateLoginPassword')
                              ->with('pourlecoup', 'peza')
                              ->willDo(
                                       function() use(&$authenticated) {
                                         return $authenticated = false;
                                       }));

  }

  public function tearDown() {
    ZendAfi_Auth::setInstance(null);
    parent::tearDown();
  }


  public function authenticationMethod(){
    return [['boite-login'],
            ['login']
    ];
  }


  /** @test
   *  @dataProvider authenticationMethod
   */
  public function boiteLoginConnectWithAfterLoginSuccessRedirectShouldForwardToOpacViewnotice($auth_method) {
    $this->postDispatch('opac/auth/'.$auth_method.'/id_profil/3',
                        ['username' => 'pourlecoup',
                         'password' => 'puocelruop']);

    $this->assertRedirectTo('/recherche/viewnotice/id/2');
  }



  /** @test
   */
  public function loginConnectWithAfterLoginErrorRedirectShouldForwardToOpacViewnotice() {
    $this->postDispatch('opac/auth/login/id_profil/3',
                        ['username' => 'pourlecoup',
                         'password' => 'peza']);

    $this->assertRedirectTo('/recherche/viewnotice/id/2');
  }
}



class AuthenticationIntentAfterLoginRedirectTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();

    (new ZendAfi_Controller_Action_Helper_FlashMessenger)
      ->addPopup('/recherche/reserver/record_id/2');
    ZendAfi_Controller_Action_Helper_FlashMessenger::reset();
    $this->dispatch('/record/items/clef/qsdfqsdf/id/2');
  }


  /** @test */
  public function pageShouldContainsScriptOpacDialogWithRechercheReserverId2() {
    $this->assertXPathContentContains('//script', 'opacDialogFromUrl("/recherche/reserver/record_id/2/render/popup");});');
  }


  /** @test */
  public function sessionShouldNotContainsFlashMessengerPopupRechercheReserver() {
    $this->assertNotFlashMessengerPopup();
  }
}




class AuthenticationIntentPostLoginTest extends AuthenticationIntentWithoutLoginWidgetTestCase {
  public function setUp() {
    parent::setUp();

    $this->fixture(Class_Users::class,
                   ['id' => 879,
                    'login' => 'Thomas',
                    'password' => 'go']);

    $this->postDispatch('/auth/login/redirect_url/'
                        . urlencode('/recherche/viewnotice/id/2')
                        . '/after_login_do/'
                        . urlencode('/recherche/reserver/record_id/2'),
                        ['username' => 'Thomas',
                         'password' => 'go']);
  }


  /** @test */
  public function shouldRedirectToRechercheViewnoticeIdTwo() {
    $this->assertRedirectTo('/recherche/viewnotice/id/2');
  }


  /** @test */
  public function sessionShouldNotContainsFlashMessengerPopupRechercheReserver() {
    $this->assertFlashMessengerContainsPopup('/recherche/reserver/record_id/2/render/popup');
  }
}




class AuthenticationIntentConnexionProfilWithRedirectTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();
    $this->dispatch('/index/index/id_profil/3/redirect_url/'
                    . urlencode('/recherche/viewnotice/id/2')
                    . '/after_login_do/'
                    . urlencode('/recherche/reserver/id/2'));
  }


  /** @test */
  public function boiteLoginFormActionShouldContainsRedirectUrlToRechercheViewNoticeAndAfterLogin() {
    $this->assertXPath('//form[contains(@action, "/auth/login/id_profil/3'
                       . '/redirect_url/'
                       . urlencode('/recherche/viewnotice/id/2')
                       . '/after_login_do/'
                       . urlencode('/recherche/reserver/id/2')
                       .'")]');
  }


  /** @test */
  public function boiteLoginFormActionShouldNotContainsSimpleRedirect() {
    $this->assertNotXPath('//form[contains(@action, "/redirect/")]');
  }


  /** @test */
  public function afterLoginDoRechercheReserverShouldBeSavedInSession() {
    $this->assertEquals('/recherche/reserver/id/2', Zend_Registry::get('session')->after_login_do);
  }


  /** @test */
  public function redircetUrlRechercheViewnoticeShouldBeSavedInSession() {
    $this->assertEquals('/recherche/viewnotice/id/2', Zend_Registry::get('session')->redirect_url);
  }
}




abstract class AuthenticationIntentLoginWithIdentityProviderTestCase
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  protected $_provider;

  public function setUp() {
    parent::setUp();

    Class_AdminVar::set('ENABLE_IDENTITY_PROVIDERS', 1);

    ZendAfi_Auth::getInstance()->clearIdentity();

    $user = $this->fixture(Class_Users::class,
                           ['id' => 98134,
                            'login' => 'mysuperid',
                            'nom' => 'James',
                            'prenom' => 'P.D.',
                            'password' => '1234',
                            'civilite' => "1",
                            'date_naissance' => '2022-12-08']);

    $this->_provider =
      $this->fixture(Class_IdentityProvider::class,
                     ['id' => 1,
                      'label' => 'Médiathèque Deauville',
                      'type' => 'cas3',
                      'config' => json_encode
                      (['url' => 'http://moncompte.server.com/cas-server-v3/',
                        'auto_create_users' => 1,
                        'associate_on_login' => 1,
                        'mapping'  =>
                        ['nom'  => 'lastname',
                         'prenom'  => 'firstname',
                         'mail'  => 'mail',
                         'id_site' => 'site_code']])]);

    $this->fixture(Class_User_Identity::class,
                   ['id' => 789,
                    'user_id' => 98134,
                    'provider_id' => 1,
                    'identifier' => 'mysuperid']);

    $response = $this->mock()
                     ->whenCalled('isError')->answers(false)

                     ->whenCalled('getBody')
                     ->answers(file_get_contents(__DIR__.'/IdentityProvider/cas3ticket.xml'));

    Class_WebService_Cas3::setWebClient($this->mock()
                                        ->whenCalled('getResponse')
                                        ->answers($response));

    Zend_Registry::get('session')->after_login_do = '/recherche/reserver/id/2';
    Zend_Registry::get('session')->redirect_url = '/recherche/viewnotice/id/2';
  }
}




class AuthenticationIntentLoginWithIdentityProviderTest
  extends AuthenticationIntentLoginWithIdentityProviderTestCase {

  public function setUp() {
    parent::setUp();

    $this->dispatch('/auth/login/provider/1?ticket=testticket&redirect=');
  }


  /** @test */
  public function jamesShouldBeLogged() {
    $this->assertNotNull(Class_Users::getIdentity());
  }


  /**
   * @test
   * @depends jamesShouldBeLogged
   */
  public function shouldRedirectToRechercheViewnoticeIdTwo() {
    $this->assertRedirectTo('/recherche/viewnotice/id/2');
  }



  /**
   * @test
   * @depends jamesShouldBeLogged
   */
  public function sessionShouldNotContainsFlashMessengerPopupRechercheReserver() {
    $this->assertFlashMessengerContainsPopup('/recherche/reserver/id/2/render/popup');
class AuthenticationIntentLoginWithIdentityProviderWithRedirectProfileTest
  extends AuthenticationIntentLoginWithIdentityProviderTestCase {

  protected $_provider;

  public function setUp() {
    parent::setUp();
    $this->fixture(class_Profil::class,
                   ['id' => 5,
                    'label' => 'Mon Profil test'
                   ]);

    $this->_provider->setProfilRedirect(5)->save();

    $this->dispatch('/auth/login/provider/1?ticket=testticket&redirect=');
  }


  /** @test */
  public function jamesShouldBeLogged() {
    $this->assertNotNull(Class_Users::getIdentity());
  }


  /**
   * @test
   */
  public function shouldRedirectToRechercheViewnoticeIdTwo() {
    $this->assertRedirectTo('/recherche/viewnotice/id/2');
  }


  /**
   * @test
   */
  public function sessionShouldNotContainsFlashMessengerPopupRechercheReserver() {
    $this->assertFlashMessengerContainsPopup('/recherche/reserver/id/2/render/popup');
}




class AuthenticationIntentModulePlanetNemoNotLoggedTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();
    RessourcesNumeriquesFixtures::activatePlanetNemo();
    $this->dispatch('/opac/modules/planetnemo');
  }


  /** @test */
  public function bodyShouldContainsScriptToRedirectToIndexIndexIdProfil3AndRedirectParamToModulesPlanetNemo() {
    $this->assertXPathContentContains('//script',
                                      '/index/index/id_profil/3/redirect_url/');
    $this->assertXPathContentContains('//script',
                                      '%2Fmodules%2Fplanetnemo');
  }
}




class AuthenticationIntentModulesArteVodNotLoggedTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();
    Class_AdminVar::set('ArteVod_SSO_KEY', '123');
    Class_AdminVar::set('ArteVod_LOGIN', '123');

    $this->dispatch('/opac/modules/arte-vod');
  }


  /** @test */
  public function shouldRedirectToIndexIndexIdProfil3AndRedirectUrlParamToModulesArteVod() {
    $this->assertRedirectTo('/index/index/id_profil/3/redirect_url/'
                            . urlencode('http://localhost'
                                        . BASE_URL . '/modules/arte-vod'));
class AuthenticationIntentDispatchAuthSubscribeNewsletterTest
  extends AuthenticationIntentWithoutLoginWidgetTestCase {

  public function setUp() {
    parent::setUp();
    $this->fixture(Class_Newsletter::class,
                   ['id' => 35,
                    'titre' => 'Jeunesse',
                    'mail_subject' => 'Jeunesse'
                   ]);
    $_SERVER['HTTP_REFERER'] = 'http://localhost/vos-acces';

    $this->dispatch('/auth/newsletter-register/id/35');
  }


  public function tearDown(){
    $_SERVER['HTTP_REFERER']='';
    parent::tearDown();
  }


  /** @test */
  public function linkDejaUnCompteShouldBeAuthenticationProfil() {
    $this->assertXPathContentContains('//a[@href="/index/index/id_profil/3/redirect_url/'
                                      . urlencode($_SERVER['HTTP_REFERER'])
                                      . '/after_login_do/'
                                      . urlencode('/auth/newsletter-register/id/35')
                                      .'"]'
                                      , "J'ai déjà un compte"
    );
  }
}




class AuthenticationIntentLogoutTest extends AbstractControllerTestCase {
  public function setUp() {
    parent::setUp();
    Zend_Registry::get('session')->after_login_do = '/recherche/reserver/id/2';
    Zend_Registry::get('session')->redirect_url = '/recherche/viewnotice/id/2';
    $this->dispatch('/auth/logout');
  }


  /** @test */
  public function sessionRedirectUrlShouldBeEmpty() {
    $this->assertEmpty(Zend_Registry::get('session')->redirect_url);
  }


  /** @test */
  public function sessionAfterLoginDoShouldBeEmpty() {
    $this->assertEmpty(Zend_Registry::get('session')->after_login_do);
  }
}