From a1224ce01841073629367c845e23c1be1b108c0d Mon Sep 17 00:00:00 2001 From: tonnesen Date: Tue, 29 Oct 2002 18:05:09 +0000 Subject: [PATCH] Added some more cataloging tests. --- t/webscripts/catalog.t | 59 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/t/webscripts/catalog.t b/t/webscripts/catalog.t index b2dabed63e..54f81dc0d8 100644 --- a/t/webscripts/catalog.t +++ b/t/webscripts/catalog.t @@ -1,4 +1,4 @@ -BEGIN { $| = 1; print "1..6\n"; +BEGIN { $| = 1; print "1..19\n"; $::intranetdir=`grep intranetdir /etc/koha.conf`; chomp $::intranetdir; $::intranetdir=~s/\s*intranetdir\s*=\s*//i; @@ -42,6 +42,10 @@ $test='Subject search - bear'; $script="$intranetdir/cgi-bin/search.pl subject=bear"; contains($script, $test, ['subjectitems=BEARS-BLACK', 'subjectitems=GRIZZLY%20BEARS']); +$test='Subjectitem search - BEARS-BLACK'; +$script="$intranetdir/cgi-bin/search.pl subjectitems=BEARS-BLACK"; +contains($script, $test, ['Encounters With Black Bears and Grizzly Bears', 225]); + $test='Dewey search - 599'; $script="$intranetdir/cgi-bin/search.pl dewey=599"; contains($script, $test, [70,208]); @@ -50,6 +54,10 @@ $test='Illustrator search - blades'; $script="$intranetdir/cgi-bin/search.pl illustrator=blades"; contains($script, $test, [270]); +$test='Barcode search - T120'; +$script="$intranetdir/cgi-bin/search.pl 'itemnumber=T120'"; +contains($script, $test, [133, 'Floating Schools and Frozen Inkwells']); + $test='Detail - biblio #270'; $script="$intranetdir/cgi-bin/detail.pl bib=270"; @@ -69,6 +77,22 @@ $script="$intranetdir/cgi-bin/modbib.pl 'bibnum=163&submit.x=modify'"; contains($script, $test, ['name=Author value="Wellikoff, Alan"', 'name=Title value="The Historical Supply Catalogue"']); +# 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->execute('UNITED STATES-MANUFACTURERS-CATALOGUE'); +unless ($sth->rows) { + $sth=$dbh->prepare("insert into catalogueentry (entrytype,catalogueentry) values ('s', ?)"); + $sth->execute('UNITED STATES-MANUFACTURERS-CATALOGUE'); +} +$sth=$dbh->prepare("select * from catalogueentry where entrytype='s' and catalogueentry=?"); +$sth->execute('CATALOGUES-HISTORICAL SUPPLIES'); +unless ($sth->rows) { + $sth=$dbh->prepare("insert into catalogueentry (entrytype,catalogueentry) values ('s', ?)"); + $sth->execute('CATALOGUES-HISTORICAL SUPPLIES'); +} + $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']); @@ -77,6 +101,37 @@ $test='Modify Biblio change title back to "The Historical Supply Catalogue" - bi $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']); +$test='Delete Biblio with items - biblio #163'; +$script="$intranetdir/cgi-bin/delbiblio.pl 'biblio=163'"; +contains($script, $test, ['delete them before deleting this biblio']); + +$test='Delete Biblio with no items - biblio #57'; +$script="$intranetdir/cgi-bin/delbiblio.pl 'biblio=57'"; +contains($script, $test, ['location:', 'catalogue-home.pl']); + +my $query="select * from deletedbiblio where biblionumber=57"; +$sth=$dbh->prepare($query); +$sth->execute; +if (my @data=$sth->fetchrow_array) { + $sth->finish; + $query="Insert into biblio values ("; + foreach my $temp (@data){ + $temp=~ s/\'/\\\'/g; + $query.=$dbh->quote($temp).","; + } + $query=~ s/\,$/\)/; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; + $query = "delete from deletedbiblio where biblionumber=57"; + $sth=$dbh->prepare($query); + $sth->execute; + $sth->finish; +} + +$test='Modify biblioitem (group) - biblio #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]); @@ -93,7 +148,7 @@ sub contains { } foreach my $string (@$contains) { unless ($result=~/$string/) { - print "not ok ".$testnumber++." $test $string\n"; + print "not ok ".$testnumber++." $test (couldn't find '$string')\n"; return; } } -- 2.39.5