Newer
Older
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* 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).
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

gloas
committed
class AbonneControllerSuggestionAchatAddFormTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_CosmoVar::newInstanceWithId('types_docs', ['liste' => '']);
$this->fixture('Class_TypeDoc', ['id' => 6 ,
'label' => 'Blueray',
'famille_id' => Class_CodifTypeDoc::VIDEO]);
$this->fixture('Class_Bib', ['id' => 11,
'libelle' => 'Bib de la plage']);
Class_Profil::getCurrentProfil()
->setCfgModules(['abonne' => ['suggestion-achat-add' => ['help-text' => 'Entrez votre suggestion']]]);
$this->dispatch('/opac/abonne/suggestion-achat-add', true);
}
/** @test */
public function pageShouldContainsDivHelpTextWithEntrezVotreSuggestion() {
$this->assertXPathContentContains('//div[@class="help-text"]', 'Entrez votre suggestion');
}
/** @test */
public function pageTitleShouldBeSuggestionAchat() {
$this->assertXPathContentContains('//title', 'Suggérer un achat');
}
/** @test */
public function boiteShouldHaveTitleSuggestionAchat() {
$this->assertXPathContentContains('//div[@class="boiteMilieu"]//h1', 'Suggérer un achat');
}
/** @test */
public function formShouldContainsInputForTitre() {
$this->assertXPath('//form//input[@name="titre"][@placeholder="ex: Harry Potter à l\'école des sorciers"]');
}
/** @test */
public function formShouldContainsSelectForDocumentType() {
$this->assertXPath('//form//select[@name="type_doc_id"]');
}
/** @test */
public function typeDocBlueRayShouldBePresent() {
$this->assertXPath('//form//select[@name="type_doc_id"]//option[@value="6"][@label="Blueray"]');
}
/** @test */
public function rssShouldNotBePresent() {
$this->assertNotXpath('//form//select[@name="type_doc_id"]//option[@value="9"][@label="fils rss"]');
}

Ghislain Loas
committed
/** @test */
public function formShouldContainsInputForAuteur() {
$this->assertXPath('//form//input[@name="auteur"][@placeholder="ex: Joanne Kathleen Rowling"]');
}
/** @test */
public function formShouldContainsInputForDescriptionUrl() {
$this->assertXPath('//form//input[@type="url"][@name="description_url"][@placeholder="ex: http://fr.wikipedia.org/wiki/Harry_Potter_à_l\'école_des_sorciers"]');
}
/** @test */
public function formShouldContainsInputForISBN() {
$this->assertXPath('//form//input[@name="isbn"][@placeholder="ex: 2-07-054127-4"]');
}
/** @test */
public function libraryShouldBeSetByDefault() {
$this->assertXPath('//form//select[@name="bib_id"]//option[@value="11"][@selected="selected"]');
}
/** @test */
public function formShouldContainsTextAreaForCommentaire() {
$this->assertXPath('//form//textarea[@name="commentaire"]');
}
/** @test */
public function formShouldContainsSubmitButtonEnvoyer() {
$this->assertXPath('//form//input[@type="submit"][@value="Envoyer"]');
}
class AbonneControllerSuggestionAchatAddFormMultipleBibsTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_Bib', ['id' => 11,
'libelle' => 'Bib de la plage']);
$this->fixture('Class_Bib', ['id' => 12,
'libelle' => 'Bib de la plage 2']);
$user = $this->fixture('Class_Users', [
'id' => 3,
'login' => 'test',
'password' => 'test',
'id_site' => 12,
]);
ZendAfi_Auth::getInstance()->logUser($user);
$this->dispatch('/opac/abonne/suggestion-achat-add', true);
}
/** @test */
public function formShouldContainsSelectForLibrary() {
$this->assertXPath('//form//select[@name="bib_id"]');
}
/** @test */
public function librarySelectShouldContainBibDeLaPlage() {
$this->assertXPath('//form//select[@name="bib_id"]//option[@value="11"][@label="Bib de la plage"]/following-sibling::option[@value="12"][@label="Bib de la plage 2"]');
}
/** @test */
public function noLibraryShouldHaveBeenSelectedByDefault() {
$this->assertXPath('//form//select[@name="bib_id"]//option[1][@value="0"]');
}
}
class AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaNotRestfulTest extends AbstractControllerTestCase {
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
public function setUp() {
parent::setUp();
$sigb_plage = $this->fixture('Class_IntBib',
[
'id' => 3,
'comm_params' => ['url_serveur' => 'http://plage.com/cgi-bin/koha/ilsdi.pl',
'restful' => '0'],
'comm_sigb' => Class_IntBib::COM_KOHA
]);
$this->fixture('Class_Bib', ['id' => 12,
'libelle' => 'Bib de la plage 2',
'int_bib' => $sigb_plage]);
$user = $this->fixture('Class_Users', [
'id' => 3,
'login' => 'test',
'password' => 'test',
'id_site' => 12,
'int_bib' => $sigb_plage,
]);
ZendAfi_Auth::getInstance()->logUser($user);
$this->dispatch('/opac/abonne/suggestion-achat-add', true);
}
/** @test */
public function formShouldContainsTextAreaForCommentaire() {
$this->assertXPath('//form//textarea[@name="commentaire"]');
}
Loading full blame...