Koha/t/db_dependent/Acquisition.t
Colin Campbell 0d082204ea Bug5063: C4::Bookseller Changes
Merge unfao changes to C4::Bookseller
Enable warnings in Bookseller.pm
Some cleanups in Bookseller code
Do not export everything by default
Display vendors more rationally
    Was displaying by id make it name as the searchstring is for all
    embedded substrings
Have removed "if mysql" logic as we want to deal with this by
    abstracting the DB interaction and it makes cleaner code until then

Sponsered by UN FAO, Rome

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-03-12 08:42:26 +13:00

73 lines
2.4 KiB
Perl
Executable file

#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Data::Dumper;
use C4::Bookseller qw( GetBookSellerFromId );
use Test::More tests => 37;
BEGIN {
use_ok('C4::Acquisition');
}
my $booksellerid = 1;
my $booksellerinfo = GetBookSellerFromId( $booksellerid );
# diag( Data::Dumper->Dump( [ $booksellerinfo ], [ 'booksellerinfo' ] ) );
SKIP: {
skip 'No booksellers in database, cannot test baskets', 2 unless $booksellerinfo;
my ($basket, $basketno);
ok($basketno = NewBasket(1,1), "NewBasket( 1 , 1 ) returns $basketno");
ok($basket = GetBasket($basketno), "GetBasket($basketno) returns $basket");
}
my $supplierid = 1;
my $grouped = 0;
my $orders = GetPendingOrders( $supplierid, $grouped );
isa_ok( $orders, 'ARRAY' );
SKIP: {
skip 'No relevant orders in database, cannot test baskets', 33 unless( scalar @$orders );
# diag( Data::Dumper->Dump( [ $orders ], [ 'orders' ] ) );
my @expectedfields = qw( basketno
biblioitemnumber
biblionumber
booksellerinvoicenumber
budgetdate
cancelledby
closedate
creationdate
currency
datecancellationprinted
datereceived
ecost
entrydate
firstname
freight
gst
listprice
notes
ordernumber
purchaseordernumber
quantity
quantityreceived
rrp
serialid
sort1
sort2
subscription
supplierreference
surname
timestamp
title
totalamount
unitprice );
my $firstorder = $orders->[0];
for my $field ( @expectedfields ) {
ok( exists( $firstorder->{ $field } ), "This order has a $field field" );
}
}