Newer
Older
<?php
/**
* Copyright (c) 2012, 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
*/
require_once 'AbstractControllerTestCase.php';
class PrintControllerIndexActionTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$modele_lettre_stagiaires = $this->fixture('Class_ModeleFusion',
['id' => 19,
'nom' =>'FORMATION_LISTE_STAGIAIRES',
'contenu' => '<h1>Liste des stagiaires pour la session du {session_formation.date_debut_texte} au {session_formation.date_fin_texte}</h1>
<h2>{session_formation.formation.libelle}</h2>
{session_formation.stagiaires["Nom":nom, "Prénom":prenom, "Bibliothèque":bib.libelle, "Téléphone":telephone]}']);
$this->fixture('Class_ModeleFusion', ['id' => 1,
'nom' => 'Template recherche',
'contenu' => '<p> {notices.each[<img src="{url_vignette}"/> {titre_principal} <div>{article.contenu}</div>
]}</p>',
/** @test */
public function pageShouldNotContainsFormationTemplates() {
$this->assertNotXPathContentContains('//div' , 'FORMATION_LISTE_STAGIAIRES',$this->_response->getBody());
}
/** @test */
public function pageShouldNotContainsRechercheTemplate() {
$this->assertXPathContentContains('//div' , 'Template recherche',$this->_response->getBody());
}
}
class PrintControllerAddActionTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->dispatch('/admin/print/add',true);
}
/** @test */
public function pageShouldDisplayAjouterUnModele() {
$this->assertXPathContentContains('//h1', 'Ajouter un modèle',$this->_response->getBody());
}
/** @test */
public function pageShouldDisplayProfils() {
$this->assertXPath('//input[@name="profil_ids"]',$this->_response->getBody());
}
}
class PrintControllerPostActionTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->postDispatch('/admin/print/add', ['nom' => 'recherche',
'type' => 'Notice_List',
'profil_ids' => '5;6',
'contenu' => 'test']
);
}
/** @test */
public function templateShouldSaveProfils() {
$this->assertEquals('5;6',Class_ModeleFusion::find(1)->getProfilIds());
}
}