From 96d06437db75337a5bb152cdc3febcded527d0ca Mon Sep 17 00:00:00 2001 From: tonnesen Date: Tue, 29 Oct 2002 19:26:27 +0000 Subject: [PATCH] Added some more tests to catalog.t --- .../default/en/parameters/admin-home.tmpl | 4 +- t/webscripts/catalog.t | 79 ++++++++++++++++++- testKoha.pl | 4 + 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl index 597acd6eb2..07f4993c70 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl @@ -11,11 +11,9 @@ CurrenciesCurrencies of booksellers. PrintersPrinters (UNIX paths). stopwordsWords deleted during searches +Z39.50 ServersServers used to download MARC records to Koha systempreferencesSystem preferences -TableMeaning -MARC tag structureMARC structure : tag then subfields -Links koha - MARC DBDefine links between the koha standard DB and the MARC one. Note those links can be defined through MARC structure. This tool is just a shortcut to speed up linkage diff --git a/t/webscripts/catalog.t b/t/webscripts/catalog.t index 54f81dc0d8..4682209fd2 100644 --- a/t/webscripts/catalog.t +++ b/t/webscripts/catalog.t @@ -1,4 +1,4 @@ -BEGIN { $| = 1; print "1..19\n"; +BEGIN { $| = 1; print "1..28\n"; $::intranetdir=`grep intranetdir /etc/koha.conf`; chomp $::intranetdir; $::intranetdir=~s/\s*intranetdir\s*=\s*//i; @@ -13,6 +13,9 @@ use C4::Context; $loaded = 1; print "ok 1 Test script load\n"; +my $dbh=C4::Context->dbh(); +my $sth; + my $debug=$ARGV[0]; my $intranetdir=C4::Context->config('intranetdir'); @@ -79,8 +82,7 @@ contains($script, $test, ['name=Author value="Wellikoff, Alan"', 'name=Title val # Add subject headings for #163 to catalogueentry table -my $dbh=C4::Context->dbh(); -my $sth=$dbh->prepare("select * from catalogueentry where entrytype='s' and catalogueentry=?"); +$sth=$dbh->prepare("select * from catalogueentry where entrytype='s' and catalogueentry=?"); $sth->execute('UNITED STATES-MANUFACTURERS-CATALOGUE'); unless ($sth->rows) { $sth=$dbh->prepare("insert into catalogueentry (entrytype,catalogueentry) values ('s', ?)"); @@ -97,18 +99,61 @@ $test='Modify Biblio change title to "Testing" - biblio #163'; $script="$intranetdir/cgi-bin/updatebiblio.pl 'Author=Wellikoff%2C+Alan&Title=Testing&Subject=UNITED+STATES-MANUFACTURERS-CATALOGUE%7CCATALOGUES-HISTORICAL+SUPPLIES&Copyright=&Series=&Additional=&Subtitle=&Unititle=&Notes=&Serial=&Analytic=&Analytic=&bibnum=163&bibitemnum=163'"; contains($script, $test, ['location: detail.pl', 'bib=163']); +$sth=$dbh->prepare("select title from biblio where biblionumber=163"); +$sth->execute(); +my ($title) = $sth->fetchrow; +if ($title eq 'Testing') { + print "ok ".$testnumber++." title is now 'Testing'\n"; +} else { + print "not ok ".$testnumber++." title is now $title\n"; +} + + $test='Modify Biblio change title back to "The Historical Supply Catalogue" - biblio #163'; $script="$intranetdir/cgi-bin/updatebiblio.pl 'Author=Wellikoff%2C+Alan&Title=The+Historical+Supply+Catalogue&Subject=UNITED+STATES-MANUFACTURERS-CATALOGUE%7CCATALOGUES-HISTORICAL+SUPPLIES&Copyright=&Series=&Additional=&Subtitle=&Unititle=&Notes=&Serial=&Analytic=&Analytic=&bibnum=163&bibitemnum=163'"; contains($script, $test, ['location: detail.pl', 'bib=163']); +$sth=$dbh->prepare("select title from biblio where biblionumber=163"); +$sth->execute(); +my ($title) = $sth->fetchrow; +if ($title eq 'The Historical Supply Catalogue') { + print "ok ".$testnumber++." title is now 'The Historical Supply Catalogue'\n"; +} else { + print "not ok ".$testnumber++." title is now $title\n"; +} + $test='Delete Biblio with items - biblio #163'; $script="$intranetdir/cgi-bin/delbiblio.pl 'biblio=163'"; contains($script, $test, ['delete them before deleting this biblio']); +$sth=$dbh->prepare("select biblionumber from biblio where biblionumber=163"); +$sth->execute; +if ($sth->rows) { + print "ok ".$testnumber++." biblio 163 was not deleted.\n"; +} else { + print "not ok ".$testnumber++." biblio 163 is gone!\n"; +} + $test='Delete Biblio with no items - biblio #57'; $script="$intranetdir/cgi-bin/delbiblio.pl 'biblio=57'"; contains($script, $test, ['location:', 'catalogue-home.pl']); +$sth=$dbh->prepare("select * from biblio where biblionumber=57"); +$sth->execute; +if ($sth->rows) { + print "not ok ".$testnumber++." biblio 57 is still in biblio table!\n"; +} else { + print "ok ".$testnumber++." biblio 57 was deleted.\n"; +} + +$sth=$dbh->prepare("select biblionumber from deletedbiblio where biblionumber=57"); +$sth->execute; +if ($sth->rows) { + print "ok ".$testnumber++." biblio 57 is in deletedbiblio table.\n"; +} else { + print "not ok ".$testnumber++." biblio 57 is not in deletedbiblio table!\n"; +} + my $query="select * from deletedbiblio where biblionumber=57"; $sth=$dbh->prepare($query); $sth->execute; @@ -129,10 +174,36 @@ if (my @data=$sth->fetchrow_array) { $sth->finish; } -$test='Modify biblioitem (group) - biblio #331'; +$test='Modify biblioitem (group) - biblioitem #331'; $script="$intranetdir/cgi-bin/modbibitem.pl 'bibitem=331&biblio=331&submit.x=62&submit=modify'"; contains($script, $test, ['Dog stories', 'Herriot, James', 'T291', 331]); +$test='Modify biblioitem (group) change itemtype to JNF - biblioitem #331'; +$script="$intranetdir/cgi-bin/updatebibitem.pl 'existinggroup=331&existing=NO&Item=JNF&Class=HER&Publisher=&Place=&ISBN=0330296957&Publication=0&Pages=20p.+Illus.&Illustrations=&Volume=&Notes=&Size=&bibnum=331&bibitemnum=331&check_group_T291=on&submit.x=103&submit.y=30'"; +contains($script, $test, ['location:', 'moredetail.pl', 331]); + +$sth=$dbh->prepare("select itemtype from biblioitems where biblioitemnumber=331"); +$sth->execute(); +my ($itemtype) = $sth->fetchrow; +if ($itemtype eq 'JNF') { + print "ok ".$testnumber++." itemtype is now JNF\n"; +} else { + print "not ok ".$testnumber++." itemtype is now $itemtype\n"; +} + +$test='Modify biblioitem (group) change itemtype back to JF - biblioitem #331'; +$script="$intranetdir/cgi-bin/updatebibitem.pl 'existinggroup=331&existing=NO&Item=JF&Class=HER&Publisher=&Place=&ISBN=0330296957&Publication=0&Pages=20p.+Illus.&Illustrations=&Volume=&Notes=&Size=&bibnum=331&bibitemnum=331&check_group_T291=on&submit.x=103&submit.y=30'"; +contains($script, $test, ['location:', 'moredetail.pl', 331]); + + +$sth=$dbh->prepare("select itemtype from biblioitems where biblioitemnumber=331"); +$sth->execute(); +my ($itemtype) = $sth->fetchrow; +if ($itemtype eq 'JF') { + print "ok ".$testnumber++." itemtype is now JF\n"; +} else { + print "not ok ".$testnumber++." itemtype is now $itemtype\n"; +} diff --git a/testKoha.pl b/testKoha.pl index eaf28dc66c..4549b35e60 100644 --- a/testKoha.pl +++ b/testKoha.pl @@ -14,6 +14,7 @@ my @tests=( 't/koha.t', 't/output.t', 't/require.t', + 't/webscripts/catalog.t', ); @@ -22,6 +23,9 @@ runtests (@tests); exit; # $Log$ +# Revision 1.1.2.8 2002/10/29 19:26:27 tonnesen +# Added some more tests to catalog.t +# # Revision 1.1.2.7 2002/06/20 15:19:33 amillar # Test valid ISBN numbers in Input.pm # -- 2.39.5