Newer
Older
<?php
/**
* Copyright (c) 2012-2014, 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 Cosmo_DataProfileControllerTestCase extends CosmoControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_IntProfilDonnees::forKoha()
->setId(56)
->setItemField(Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE, ['zone' => '999',
'champ' => 'c'])
Class_IntProfilDonnees::forNanook()
->setId(105)
->save();
Class_IntProfilDonnees::forPergamePatrons()
->setId(106)
->save();
$this->fixture('Class_CosmoVar',
['id' => 'champs_pret',
'valeur' => null,
'liste' => "ID_PERGAME:id_pret Pergame\r\nIDABON:id abonné\r\nORDREABON:no d'ordre\r\nEN_COURS:prêt en cours\r\nDATE_PRET:date du prêt\r\nDATE_RETOUR:date de retour\r\nID_NOTICE_ORIGINE:id notice Pergame\r\nSUPPORT:code support\r\nETIQUETTE:numéro d'étiquette (incrémental)"]);
$this->fixture('Class_CosmoVar',
['id' => 'types_docs',
'valeur' => null,
'liste' => "0:non identifié\r\n1:Livres\r\n"]);
$this->fixture('Class_CosmoVar',
['id' => 'id_article_periodique',
'valeur' => null,
'liste' => "0:aucun\r\n1:pergame\r\n2:opsys indexpresse\r\n3:Koha\r\n4:Orphée"]);
public function tearDown() {
Class_IntProfilDonnees::clearCache();
Class_CosmoVar::clearCache();
Class_TypeDoc::clearCache();
Class_ScriptLoader::resetInstance();
parent::tearDown();
}
}
class Cosmo_DataProfileControllerIndexTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/cosmo/data-profile', true);
}
public function addNewProfileShouldBePresent() {
$this->assertXPath('//div', 'Ajouter un profil');
}
public function secondTrShouldContainsKoha() {
$this->assertXPathContentContains('//table//tr[2]/td', 'Koha');
public function thirdTrShouldContainsRecordsFileType() {
$this->assertXPathContentContains('//table//tr[3]/td[2]', 'Notices');
/** @test */
public function thirdTrShouldContainsUnimarcFormat() {
$this->assertXPathContentContains('//table//tr[3]/td[3]', 'Unimarc');
}
/** @test */
public function thirdTrShouldContainsNonUsedFlag() {
$this->assertXPathContentContains('//table//tr[3]/td[4]', 'Non');
}
public function secondTrShouldContainsLinkEditKohaProfile() {
$this->assertXPath('//table//tr[2]/td/a[contains(@href, "/cosmo/data-profile/edit/id/56")]');
}
/** @test */
public function thirdTrShouldContainsNanook() {
$this->assertXPathContentContains('//table//tr[3]/td', 'Nanook');
}
/** @test */
public function tableSorterJsShouldBeloaded() {
$this->assertXPath('//script[contains(@src, "/public/opac/js/tablesorter/js/jquery.tablesorter.")]');
}
/** @test */
public function jQueryUIShouldBeLoaded() {
$this->assertXPath('//script[contains(@src, "/public/admin/js/jquery-ui")]');
}
/** @test */
public function jQueryShouldBeLoaded() {
$this->assertXPath('//script[contains(@src, "/public/admin/js/jquery-")]');
}
class Cosmo_DataProfileControllerEditPatronsTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
[
'id' => 57,
'libelle' => 'Some patrons',
'accents' => Class_IntProfilDonnees::ENCODING_WINDOWS_ANSI,
'rejet_periodiques' => 1,
'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE,
'type_fichier' => Class_IntProfilDonnees::FT_PATRONS,
'format' => Class_IntProfilDonnees::FORMAT_PIPED_ASCII,
'attributs' =>
[
[Class_IntProfilDonnees::FIELD_TYPE_DOC_RECOGNITION => [ ],
Class_IntProfilDonnees::FIELD_ITEM_BARCODE => '996',
Class_IntProfilDonnees::FIELD_ITEM_GENRE => '',
Class_IntProfilDonnees::FIELD_ITEM_SECTION => 'x',
Class_IntProfilDonnees::FIELD_ITEM_EMPLACEMENT => '',
Class_IntProfilDonnees::FIELD_ITEM_ANNEXE => 'a'
],
['champs' => 'PRENOM;NOM; MAIL;PRENOM'],
['champs' => 'PRENOM;NOM; MAIL;PRENOM'],
['champs' => 'PRENOM;NOM; MAIL;PRENOM']
]
]);
$this->dispatch('cosmo/data-profile/edit/id/57', true);
/** @test */
public function subscriberSelectedFieldsShouldContainsTwoPrenom() {

Laurent
committed
$this->assertXPathCount('//div[@id="input_patron_fields"]/div[1]/ul/li[@data-value="PRENOM"]', 2);
/** @test */
public function subscriberSelectedFieldsShouldContainsMail() {
$this->assertXPath('//div[@id="input_patron_fields"]/div[1]/ul/li[@data-value="MAIL"]');
}
/** @test */
public function subscriberAvailableFieldsShouldContainsPrenom() {

Laurent
committed
$this->assertXPathCount('//div[@id="input_patron_fields"]/div[2]/ul/li[@data-value="PRENOM"]', 1, $this->_response->getBody());

Patrick Barroca
committed
/** @test */
public function subscriberAvailableFieldsShouldContainsLibraryCode() {
$this->assertXPath('//div[@id="input_patron_fields"]/div[2]/ul/li[@data-value="LIBRARY_CODE"]', $this->_response->getBody());
}
class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('cosmo/data-profile/edit/id/56', true);
}
/** @test */
public function labelShouldBePresent() {
$this->assertXPath('//form//input[@type="text"][@name="libelle"][@value= "Unimarc Koha"]');
/** @test */
public function selectAccentsShouldContainsUTF8Selected() {
$this->assertXPathContentContains('//form//select[@name="accents"]/option[@value="0"][@selected]', 'UTF-8');
}
/** @test */
public function selectTypeFichierShouldContainsRecordsSelected() {
$this->assertXPathContentContains('//form//select[@name="type_fichier"]/option[@value="0"][@selected]',
'Notices');
}
/** @test */
public function selectFormatShouldContainsUnimarcSelected() {
$this->assertXPathContentContains('//form//select[@name="format"]/option[@value="0"][@selected]', 'Unimarc');
}
/** @test */
public function formatBibliondemandShouldBeAvailable() {
$this->assertXPathContentContains('//form//select[@name="format"]/option[@value="11"]', 'Dublin Core Bibliondemand');
}
/** @test */
public function fieldNouveauteJoursShouldBePresent() {
$this->assertXPath('//form//input[@id="nouveaute_jours"]');
}
/** @test */
public function multiInputNouveauteZoneChampShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_nouveaute_zone_champ"]');
}
/** @test */
public function nouveauteZoneAndChampShouldBe801AndC() {
$this->assertXPathContentContains('//script', 'values:{"nouveaute_zone":["801"],"nouveaute_champ":["c"]}');
}
/** @test */
public function selectNouveauteFormatShouldBePresent() {
$this->assertXPath('//form//select[@id="nouveaute_format"]/option[@value="' . Class_IntProfilDonnees::NOVELTY_DATE_FORMAT_AAAA_MM_JJ . '"][@selected]');
/** @test */
public function nouveauteFormatAAAAMMJJShouldExists() {
$this->assertXPathContentContains('//select[@id="nouveaute_format"]/option', 'AAAAMMJJ');
}
/** @test */
public function multiInputNouveauteValeursShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_nouveaute_valeurs"]');
}
/** @test */
public function noveltyDaysShouldBe90() {
$this->assertXPath('//form//input[@name="nouveaute_jours"][@value="90"]');
}
/** @test */
public function itemZoneValueShouldBe995() {
$this->assertXPath('//form//input[@name="item_zone"][@value="995"]');
}
/** @test */
public function itemCodebarreShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_code_barres"]/option[@value="f"][@selected]');

Patrick Barroca
committed
/** @test */
public function itemCodebarreIn949Dollar6ShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_code_barres"]/option[@value="949"][contains(@label,"949$6")]');

Patrick Barroca
committed
}
/** @test */
public function itemCoteShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_cote"]/option[@value="k"][@selected]');
}
/** @test */
public function itemTypeDocShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_type_doc"]/option[@value="r"][@selected]');
}
/** @test */
public function itemSectionShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_section"]/option[@value="q"][@selected]');
}
/** @test */
public function itemGenreShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_genre"]/option[@value=""]');
}
/** @test */
public function itemEmplacementShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_emplacement"]/option[@value="e"][@selected]');
}
/** @test */
public function itemAnnexeShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_annexe"]/option[@value="b"][@selected]');
}
/** @test */
public function itemDisponibiliteShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_availability"]/option[@value=""]');
}
/** @test */
public function multiInputItemUrlShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_item_url"]');
}
/** @test */
public function multiInputItemIdOrigineShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_item_id_origine"]');
}
/** @test */
public function scriptShouldSetMutiInputsItemIdOrigineTo999dollarC() {
$this->assertXPathContentContains('//script', 'values:{"id_origine_zone":["999"],"id_origine_champ":["c"]}');
}
/** @test */
public function multiInputInteretZoneShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_interests"]');
public function selectRejetPeriodiquesShoudHaveNoSelected() {
$this->assertXPathContentContains('//form//select[@id="rejet_periodiques"]/option[@value="0"][@selected]', 'Non');
}
/** @test */
public function selectIdArticlePeriodiqueShouldBePresent() {
$this->assertXPath('//form//select[@id="id_article_periodique"]/option[@value="' . Class_IntProfilDonnees::SERIAL_FORMAT_KOHA . '"][@selected]');
}
/** @test */
public function multiInputDocTypeZeroShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_item_doc_type_0"]');
}
/** @test */
public function multiInputDocTypeOneShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_item_doc_type_1"]');
}
/** @test */
public function docTypeBookShouldBeAmNaLivLivjLivaDocManuel() {
$this->assertXPathContentContains('//script', 'values:{"1_label":["am","na"],"1_zone":["LIV","LIVJ","LIVA","DOC","MANUEL"]}');
/** @test */
public function docTypeDiMusicShouldBeEmpty() {
$this->assertXPathContentContains('//script', 'values:{"DiMusic_label":[],"DiMusic_zone":[]}');
}
class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$post = ['libelle' => 'New Koha',
'accents' => Class_IntProfilDonnees::ENCODING_ISO2709,
'type_fichier' => Class_IntProfilDonnees::FT_RECORDS,
'format' => Class_IntProfilDonnees::FORMAT_UNIMARC,
'xml_balise_abonne' => 'subscribers',
'xml_abonne_IDABON' => 'id',
'item_zone'=> '996',
'champ_code_barres'=> 'f',
'champ_cote' => 'k',
'champ_type_doc' => 'x',
'champ_section' => 'q',
'champ_genre' => 'z',
'champ_emplacement' => 'u',
'champ_annexe' => 'a',
'champ_availability' => 't',
'url_zone' => [0 => '932'],
'url_champ' => [0 => 'n'],
'id_origine_zone' => [0 => '999'],
'id_origine_champ' => [0 => 'c'],
'rejet_periodiques' => 1,
'id_article_periodique' => 1,
'nouveaute_format' => 4,
'nouveaute_jours' => 80,
'nouveaute_zone' => [0 => '932'],
'nouveaute_champ' => [0 => 'a'],
'nouveaute_valeurs' => ['nouveau',
'new'],
'interest_zone' => [0 => '932'],
'interest_champ' => [0 => '7'],
'holds' => 'SUPPORT; SUPPORT',
'carts' => 'LIBELLE; ROLE',
'loans' => 'ID_PERGAME; ID_PERGAME',
'patron_fields' => 'ORDREABON; ORDREABON'];
$this->postDispatch('cosmo/data-profile/edit/id/56', $post, true);
$this->_koha = Class_IntProfilDonnees::find(56);
}
/** @test */
public function shouldRedirectToCosmoSlashDataProfileSlashEditSlashIdSlashOne() {
$this->assertRedirectTo('/cosmo/data-profile/edit/id/56');
}
/** @test */
public function libelleShouldBeNewKoha() {
$this->assertEquals('New Koha', $this->_koha->getLibelle());
}
/** @test */
public function accentsShouldBeISO2709() {
$this->assertEquals(Class_IntProfilDonnees::ENCODING_ISO2709, $this->_koha->getAccents());
/** @test */
public function itemZoneShouldBe996() {
$this->assertEquals('996', $this->_koha->getItemZone());
}
/** @test */
public function champsCodeBarresShouldBeF() {
$this->assertEquals('f', $this->_koha->getBarCode());
}
/** @test */
public function champsAvailabilityBeT() {
$this->assertEquals('t', $this->_koha->getAvailability());
/** @test */
public function urlLabelShouldBeIn932() {
$this->assertEquals('932', $this->_koha->getUrlLabel());
}
/** @test */
public function urlFieldShouldBeInN() {
$this->assertEquals('n', $this->_koha->getUrlField());
}
/** @test */
public function idOrigineZoneShouldBe999() {
$this->assertEquals('999', $this->_koha->getIdOrigineZone());
}
/** @test */
public function idOrigineFieldShouldBeC() {
$this->assertEquals('c', $this->_koha->getIdOrigineField());
}
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
/** @test */
public function serialsRejectShouldBeOne() {
$this->assertEquals(1, $this->_koha->getRejetPeriodiques());
}
/** @test */
public function noveltyFormatShouldBe4() {
$this->assertEquals(4, $this->_koha->getNoveltyFormat());
}
/** @test */
public function noveltyDaysShouldBe80() {
$this->assertEquals(80, $this->_koha->getNoveltyDays());
}
/** @test */
public function noveltyLabelShouldBe932() {
$this->assertEquals(932, $this->_koha->getNoveltyLabel());
}
/** @test */
public function noveltyFieldShouldBeA() {
$this->assertEquals('a', $this->_koha->getNoveltyField());
}
/** @test */
public function noveltyValeursShouldBeNouveauAndNew() {
$this->assertEquals('nouveau;new', $this->_koha->getNoveltyValues());
}
/** @test */
public function interestLabelShouldBe932() {
$this->assertEquals(932, $this->_koha->getInterestLabel());
}
/** @test */
public function interestFieldShouldBe7() {
$this->assertEquals('7', $this->_koha->getInterestField());
}
class Cosmo_DataProfileControllerPostEditFieldsTest extends Cosmo_DataProfileControllerTestCase {
protected
$_nanook_profile;
public function setUp() {
parent::setUp();
$this->_nanook_profile = Class_IntProfilDonnees::find(105);
/** @test */
public function patronsFieldsShouldContainsIdPergame() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_PATRONS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_CSV,
'carts' => 'ID_ABO',
Class_IntProfilDonnees::PROFILE_PATRON_FIELDS => 'ID_PERGAME; ID_PERGAME'], true);
$this->assertEquals('ID_PERGAME; ID_PERGAME', $this->_nanook_profile->getPatronsFieldsValues());
}
/** @test */
public function loansFieldsShouldContainsIdPergame() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_LOANS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_CSV,
'carts' => 'ID_ABO',
Class_IntProfilDonnees::PROFILE_LOANS_FIELDS => 'ID_PERGAME; ID_PERGAME'], true);
$this->assertEquals('ID_PERGAME; ID_PERGAME', $this->_nanook_profile->getLoansFieldsValues());
}
/** @test */
public function lightRecordsFieldsShouldContainsEan() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_RECORDS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_CSV,
Class_IntProfilDonnees::PROFILE_ITEM_FIELDS => 'ean;ean'], true);
$this->assertEquals('ean;ean', $this->_nanook_profile->getCSVRecordFieldsValues());
}
/** @test */
public function holdsFieldsShouldContainsSupport() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_HOLDS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_CSV,
$this->assertEquals('SUPPORT; SUPPORT', $this->_nanook_profile->getHoldsFieldsValues());
}
/** @test */
public function cartsFieldsShouldContainsLibelleAndRole() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_BASKETS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_CSV,
$this->assertEquals('LIBELLE; ROLE', $this->_nanook_profile->getCartsFieldsValues());
}
/** @test */
public function docTypeFieldsShouldBeAsExpected() {
$doc_type = ['1_label' => ['am',
'af',
'bb'],
'1_zone' => ['z',
't',
'u'],
Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_RECORDS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_UNIMARC];
$this->postDispatch('cosmo/data-profile/edit/id/105', $doc_type, true);
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
$this->assertEquals(['code' => '1', 'label' => 'am;af;bb', 'zone_995' => 'z;t;u'],
$this->_nanook_profile->getItemDocTypesPrefs()[1]);
}
/** @test */
public function postXMLPatronsShouldFillXmlPatronField() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_PATRONS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_XML,
'xml_balise_abonne' => 'items',
'xml_abonne_IDABON'=> 'id',
'xml_abonne_DATE_DEBUT' => 'start',
'xml_abonne_DATE_FIN' => 'end',
], true);
$this->assertEquals('items', $this->_nanook_profile->getXmlPatronField());
return $this->_nanook_profile;
}
/**
* @depends postXMLPatronsShouldFillXmlPatronField
* @test
*/
public function postXMLPatronsShouldFillXmlPatronFieldForIDABON($profile) {
$this->assertEquals($profile->getXmlPatronFieldsAt('IDABON'), 'id');
}
/**
* @depends postXMLPatronsShouldFillXmlPatronField
* @test
*/
public function postXMLPatronsShouldFillXmlPatronFieldForDATEFIN($profile) {
$this->assertEquals($profile->getXmlPatronFieldsAt('DATE_FIN'), 'end');
}
/** @test */
public function subscribersFieldsShouldContainsOrdreabon() {
$this->postDispatch('cosmo/data-profile/edit/id/105',
[Class_IntProfilDonnees::PROFILE_FILE_TYPE => Class_IntProfilDonnees::FT_PATRONS,
Class_IntProfilDonnees::PROFILE_FILE_FORMAT => Class_IntProfilDonnees::FORMAT_PIPED_ASCII,
'patron_fields' => 'ORDREABON; ORDREABON'], true);
$this->assertEquals('ORDREABON; ORDREABON', $this->_nanook_profile->getPatronsFieldsValues());
class Cosmo_DataProfileControllerAddActionTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/cosmo/data-profile/add', true);
}
/** @test */
public function formShouldBePresent() {
$this->assertXPath('//form');
}
/** @test */
public function authorityTypeShouldBeAvailable() {
$this->assertXPath('//form//select[@id="type_fichier"]//option[@value="' . Class_IntProfilDonnees::FT_AUTHORITY . '"]');
}
}
class Cosmo_DataProfileControllerDeleteActionTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/cosmo/data-profile/delete/id/56', true);
}
/** @test */
public function shouldRedirectToCosmoSlashDataProfileSlashIndex() {
$this->assertRedirectTo('/cosmo/data-profile/index');
}
}
class Cosmo_DataProfileControllerEditPergamePatronsTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('cosmo/data-profile/edit/id/106', true);
}
/** @test */
public function inputForLibelleShouldContainsPergamePatrons() {
$this->assertXPath('//input[@name="libelle"][@value="Pergame patrons"]');
}
/** @test */
public function inputSubscribersLightShouldContainsFieldsIDABON_ORDREABON_etc() {

Laurent
committed
$this->assertXPath('//input[@name="patron_fields"][@value="IDABON;ORDREABON;NOM;PRENOM;NAISSANCE;DATE_DEBUT;DATE_FIN;MAIL"]',
$this->_response->getBody());
}
class Cosmo_DataProfileControllerEditNanookPatronsRegressionTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
[
'id' => 59,
'libelle' => 'Nanook patrons',
'accents' => Class_IntProfilDonnees::ENCODING_UTF8,
'rejet_periodiques' => 1,
'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE,
'type_fichier' => Class_IntProfilDonnees::FT_PATRONS,
'format' => Class_IntProfilDonnees::FORMAT_CSV,
'attributs' =>
[ 0 => [Class_IntProfilDonnees::FIELD_TYPE_DOC_RECOGNITION => [ ],
Class_IntProfilDonnees::FIELD_ITEM_BARCODE => '996',
Class_IntProfilDonnees::FIELD_ITEM_GENRE => '',
Class_IntProfilDonnees::FIELD_ITEM_SECTION => 'x',
Class_IntProfilDonnees::FIELD_ITEM_EMPLACEMENT => '',
Class_IntProfilDonnees::FIELD_ITEM_ANNEXE => 'a'
],
1 => ['champs' => 'IDABON;PIKA_PIKA;ORDREABON;NOM;PRENOM;PASSWORD;MAIL'],
2 => ['champs' => 'IDABON;PIKA_PIKA;ORDREABON;NOM;PRENOM;PASSWORD;MAIL'],
3 => ['champs' => 'IDABON;PIKA_PIKA;ORDREABON;NOM;PRENOM;PASSWORD;MAIL'],
4 => ['zone' => '', 'champ' => '', 'format' => '', 'jours' => '', 'valeurs' => ''],
5 => ['xml_balise_abonne' => '',
'xml_champs_abonne' => [
'IDABON' => '',
'ORDREABON' => '',
'NOM' => '',
'PRENOM' => '',
'NAISSANCE' => '',
'PASSWORD' => '',
'MAIL' => '',
'DATE_DEBUT' => '',
'DATE_FIN' => '',
'ID_SIGB' => '']]
]]);
$this->dispatch('cosmo/data-profile/edit/id/59', true);
}
/** @test */

Laurent
committed
public function inputPatronFieldsShouldContainsIDABON_ORDREABON_etc() {
$this->assertXPath('//input[@name="patron_fields"][@value="IDABON;ORDREABON;NOM;PRENOM;PASSWORD;MAIL"]', $this->_response->getBody());
}
/** @test */

Laurent
committed
public function paragraphForPatronFieldsShouldContainsPRENOM() {
$this->assertXPath('//div[@id="input_patron_fields"]/div[1]/ul/li[@data-value="PRENOM"]',
$this->_response->getBody());
}
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
class Cosmo_DataProfileControllerDispatchPatronProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('cosmo/data-profile/edit/id/106', true);
}
/** @test */
public function loanFieldIdAbonShouldBeDraggable() {
$this->assertXPathContentContains('//form//ul//li', 'id abonné', $this->_response->getBody());
}
}
class Cosmo_DataProfileControllerDispatchXMLPatronProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook patrons',
'accents' => Class_IntProfilDonnees::ENCODING_UTF8,
'rejet_periodiques' => 1,
'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE,
'type_fichier' => Class_IntProfilDonnees::FT_PATRONS,
'format' => Class_IntProfilDonnees::FORMAT_XML,
'attributs' =>
[0 => [Class_IntProfilDonnees::FIELD_TYPE_DOC_RECOGNITION => [ ]],
1 => [],
2 => [],
3 => [],
4 => [],
5 => ['xml_balise_abonne' => 'subscribers',
'xml_champs_abonne' => [
'IDABON' => 'id_abon',
'ORDREABON' => '',
'NOM' => '',
'PRENOM' => '',
'NAISSANCE' => '',
'PASSWORD' => '',
'MAIL' => '',
'DATE_DEBUT' => 'subscription_date',
'DATE_FIN' => '',
'ID_SIGB' => '']]]]);
$this->dispatch('cosmo/data-profile/edit/id/654', true);
}
/** @test */
public function inputXmlBaliseAbonneShouldBeSubscribers() {
$this->assertXPath('//form//input[@id="xml_balise_abonne"][@value="subscribers"]');
}
/** @test */
public function inputXmlBaliseIDABONShouldBePresent() {
$this->assertXPath('//form//input[@id="xml_abonne_IDABON"][@value="id_abon"]');
}
/** @test */
public function inputXmlBaliseDateDebutShouldBePresent() {
$this->assertXPath('//form//input[@id="xml_abonne_DATE_DEBUT"][@value="subscription_date"]');
}
}
class Cosmo_DataProfileControllerDispatchLoansProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook loans',
'type_fichier' => Class_IntProfilDonnees::FT_LOANS,
'format' => Class_IntProfilDonnees::FORMAT_CSV,
'attributs' =>
[0 => [],
1 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
2 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
3 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
4 => [],
5 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
6 => []]]);
$this->dispatch('cosmo/data-profile/edit/id/654', true);
}
/** @test */
public function fieldIdLoansShouldBeEmpty() {

Laurent
committed
$this->assertXPath('//form//input[@id="loans"][@value=""]');
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
}
}
class Cosmo_DataProfileControllerDispatchHoldsProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook Holds',
'type_fichier' => Class_IntProfilDonnees::FT_HOLDS,
'format' => Class_IntProfilDonnees::FORMAT_CSV,
'attributs' =>
[0 => [],
1 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
2 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
3 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
4 => [],
5 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
6 => []]]);
$this->dispatch('cosmo/data-profile/edit/id/654', true);
}
/** @test */
public function fieldIdHoldsShouldBeEmpty() {

Laurent
committed
$this->assertXPath('//form//input[@id="holds"][@value=""]');
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
}
}
class Cosmo_DataProfileControllerDispatchBasketsProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook baskets',
'type_fichier' => Class_IntProfilDonnees::FT_BASKETS,
'format' => Class_IntProfilDonnees::FORMAT_CSV,
'attributs' =>
[0 => [],
1 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
2 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
3 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
4 => [],
5 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
6 => []]]);
$this->dispatch('cosmo/data-profile/edit/id/654', true);
}
/** @test */
public function fieldIdCartShouldBeEmpty() {

Laurent
committed
$this->assertXPath('//form//input[@id="carts"][@value=""]');
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
}
}
class Cosmo_DataProfileControllerDispatchCSVItemsProfileTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook loans',
'type_fichier' => Class_IntProfilDonnees::FT_RECORDS,
'format' => Class_IntProfilDonnees::FORMAT_CSV,
'attributs' =>
[0 => [],
1 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
2 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
3 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
4 => [],
5 => ['champs' => 'PRENOM; NAISSANCE; PRENOM'],
6 => []]]);
$this->dispatch('cosmo/data-profile/edit/id/654', true);
}
/** @test */

Laurent
committed
public function inputCsvItemFieldsShouldBeEmpty() {
$this->assertXPath('//form//input[@name="csv_item_fields"][@value=""]',
$this->_response->getBody());
}
class Cosmo_DataProfileControllerAutoFormatTest extends Cosmo_DataProfileControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_IntProfilDonnees',
['id' => 654,
'libelle' => 'Nanook loans',