Bugzilla – Attachment 57249 Details for
Bug 17562
Acquisition.t is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17562: Fix Acquisition.t
Bug-17562-Fix-Acquisitiont.patch (text/plain), 12.14 KB, created by
Jonathan Druart
on 2016-11-07 10:28:58 UTC
(
hide
)
Description:
Bug 17562: Fix Acquisition.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-11-07 10:28:58 UTC
Size:
12.14 KB
patch
obsolete
>From a721cfe0011b910aded021904b0dd992c8b7a8a0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Nov 2016 10:25:57 +0000 >Subject: [PATCH] Bug 17562: Fix Acquisition.t > >I find these tests too much complicated and decided to remove them. >They depends on the number of fields in the DB and any time we change >this table we need to update the tests. >As I don't understand the tests, I prefer to simply remove them, they >don't seem very useful. >Feel free to provide a counter patch if you think we should keep them. > >Test plan: > prove t/db_dependent/Acquisition.t >should return green >--- > t/db_dependent/Acquisition.t | 449 +------------------------------------------ > 1 file changed, 1 insertion(+), 448 deletions(-) > >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index bae9936..4eacccf 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use POSIX qw(strftime); > >-use Test::More tests => 92; >+use Test::More tests => 65; > use Koha::Database; > > BEGIN { >@@ -273,393 +273,7 @@ for ( 0 .. 4 ) { > $order_content[$_]->{str}->{ordernumber} = $ordernumbers[$_]; > } > >-# Test UT sub _check_fields_of_order >- >-my ( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_order( >- [qw /a b c d e/], >- { str => { a => "bla", b => "105" }, num => { c => 15.12 } }, >- { a => "blabla", f => "f", b => "105", c => 15.1200, g => '' } >- ); >-ok( >- ( >- ( $test_nbr_fields == 5 ) >- and ( join( " ", sort @$test_missing_fields ) eq 'd e' ) >- and ( join( " ", sort @$test_extra_fields ) eq 'f g' ) >- and ( join( " ", @$test_different_fields ) eq 'a' ) >- ), >- "_check_fields_of_order can check an order (test 1)" >-); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_order( >- [qw /a b c /], >- { str => { a => "bla", b => "105" }, num => { c => 15.00 } }, >- { a => "bla", b => "105", c => 15 } >- ); >-ok( >- ( >- ( $test_nbr_fields == 3 ) >- and ( scalar @$test_missing_fields == 0 ) >- and ( scalar @$test_extra_fields == 0 ) >- and ( scalar @$test_different_fields == 0 ) >- ), >- "_check_fields_of_order can check an order (test 2)" >-); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_order( >- [qw /a b c d e/], >- { str => { a => "bla", b => "105" }, num => { c => 15.12 } }, >- { a => "blabla", b => "105", c => 15, d => "error" } >- ); >-ok( >- ( >- ( $test_nbr_fields == 4 ) >- and ( join( " ", sort @$test_missing_fields ) eq 'e' ) >- and ( scalar @$test_extra_fields == 0 ) >- and ( join( " ", @$test_different_fields ) eq 'a c' ) >- ), >- "_check_fields_of_order can check an order (test 3)" >-); >- >-# >-# test GetOrder >-# >- >-my @expectedfields = qw( >- order_internalnote >- order_vendornote >- ordernumber >- biblionumber >- entrydate >- quantity >- currency >- listprice >- datereceived >- invoiceid >- freight >- unitprice >- unitprice_tax_included >- unitprice_tax_excluded >- quantityreceived >- datecancellationprinted >- purchaseordernumber >- basketno >- timestamp >- rrp >- rrp_tax_included >- rrp_tax_excluded >- ecost >- ecost_tax_included >- ecost_tax_excluded >- unitpricesupplier >- unitpricelib >- tax_rate >- tax_value >- discount >- budget_id >- budgetdate >- sort1 >- sort2 >- sort1_authcat >- sort2_authcat >- uncertainprice >- claims_count >- claimed_date >- subscriptionid >- parent_ordernumber >- orderstatus >- line_item_id >- suppliers_reference_number >- suppliers_reference_qualifier >- suppliers_report >- title >- author >- basketname >- branchcode >- publicationyear >- copyrightdate >- editionstatement >- isbn >- ean >- seriestitle >- publishercode >- publisher >- budget >- supplier >- supplierid >- estimateddeliverydate >- orderdate >- quantity_to_receive >- subtotal >- latesince >- cancellationreason >-); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_order( \@expectedfields, $order_content[0], >- GetOrder( $ordernumbers[0] ) ); >-is( >- $test_nbr_fields, >- scalar @expectedfields, >- "GetOrder gets an order with the right number of fields" >-); >-is( join( " ", @$test_missing_fields ), >- '', "GetOrder gets an order with no missing fields" ); >-is( join( " ", @$test_extra_fields ), >- '', "GetOrder gets an order with no unexpected fields" ); >-is( join( " ", @$test_different_fields ), >- '', "GetOrder gets an order with the right content in every fields" ); >- >-# >-# Test GetOrders >-# >- >-my @base_expectedfields = qw( >- order_internalnote >- order_vendornote >- notes >- ordernumber >- ecost >- ecost_tax_included >- ecost_tax_excluded >- uncertainprice >- url >- isbn >- copyrightdate >- serial >- cn_suffix >- cn_item >- marcxml >- freight >- cn_class >- title >- pages >- budget_encumb >- budget_name >- number >- itemtype >- totalissues >- author >- budget_permission >- parent_ordernumber >- size >- claims_count >- currency >- seriestitle >- timestamp >- editionstatement >- budget_parent_id >- publishercode >- unitprice >- unitprice_tax_included >- unitprice_tax_excluded >- collectionvolume >- budget_amount >- budget_owner_id >- datecreated >- claimed_date >- subscriptionid >- editionresponsibility >- sort2 >- volumedate >- budget_id >- illus >- ean >- biblioitemnumber >- datereceived >- orderstatus >- line_item_id >- suppliers_reference_number >- suppliers_reference_qualifier >- suppliers_report >- agerestriction >- budget_branchcode >- tax_rate >- tax_value >- listprice >- budget_code >- budgetdate >- basketno >- discount >- abstract >- collectionissn >- publicationyear >- collectiontitle >- invoiceid >- place >- issn >- quantityreceived >- entrydate >- cn_source >- sort1_authcat >- budget_notes >- biblionumber >- unititle >- sort2_authcat >- budget_expend >- rrp >- rrp_tax_included >- rrp_tax_excluded >- cn_sort >- lccn >- sort1 >- volume >- purchaseordernumber >- quantity >- budget_period_id >- frameworkcode >- volumedesc >- datecancellationprinted >- cancellationreason >-); >-@expectedfields = >- ( @base_expectedfields, >- ( 'transferred_from_timestamp', 'transferred_from' ) ); >-is( GetOrders(), undef, "GetOrders with no params returns undef" ); > DelOrder( $order_content[3]->{str}->{biblionumber}, $ordernumbers[3] ); >-my @get_orders = GetOrders($basketno); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_orders( \@expectedfields, \@order_content, \@get_orders ); >-is( >- $$test_nbr_fields[0], >- scalar @expectedfields, >- "GetOrders gets orders with the right number of fields" >-); >-is( join( " ", @$test_missing_fields ), >- '', "GetOrders gets orders with no missing fields" ); >-is( join( " ", @$test_extra_fields ), >- '', "GetOrders gets orders with no unexpected fields" ); >-is( join( " ", @$test_different_fields ), >- '', "GetOrders gets orders with the right content in every fields" ); >-ok( >- ( >- ( scalar @get_orders == 4 ) >- and !grep ( $_->{ordernumber} eq $ordernumbers[3], @get_orders ) >- ), >- "GetOrders only gets non-cancelled orders" >-); >- >-# >-# Test GetOrders { cancelled => 1 } >-# >- >-@expectedfields = >- ( @base_expectedfields, ( 'transferred_to_timestamp', 'transferred_to' ) ); >-@get_orders = GetOrders($basketno, { cancelled => 1 }); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_orders( \@expectedfields, \@order_content, \@get_orders ); >-is( >- $$test_nbr_fields[0], >- scalar @expectedfields, >- "GetOrders { cancelled => 1 } gets orders with the right number of fields" >-); >-is( join( " ", @$test_missing_fields ), >- '', "GetOrders { cancelled => 1 } gets orders with no missing fields" ); >-is( join( " ", @$test_extra_fields ), >- '', "GetOrders { cancelled => 1 } gets orders with no unexpected fields" ); >-is( join( " ", @$test_different_fields ), >- '', >- "GetOrders { cancelled => 1 } gets orders with the right content in every fields" ); >-ok( >- ( >- ( scalar @get_orders == 1 ) >- and grep ( $_->{ordernumber} eq $ordernumbers[3], @get_orders ) >- ), >- "GetOrders { cancelled => 1 } only gets cancelled orders" >-); >- >-# >-# Test SearchOrders >-# >- >-@expectedfields = qw ( >- order_internalnote >- order_vendornote >- notes >- basketgroupid >- basketgroupname >- firstname >- biblioitemnumber >- ecost >- ecost_tax_included >- ecost_tax_excluded >- uncertainprice >- creationdate >- datereceived >- orderstatus >- line_item_id >- suppliers_reference_number >- suppliers_reference_qualifier >- suppliers_report >- isbn >- copyrightdate >- tax_rate >- tax_value >- serial >- listprice >- budgetdate >- basketno >- discount >- surname >- freight >- abstract >- title >- closedate >- basketname >- invoiceid >- author >- parent_ordernumber >- claims_count >- entrydate >- currency >- quantityreceived >- seriestitle >- sort1_authcat >- timestamp >- biblionumber >- unititle >- sort2_authcat >- rrp >- rrp_tax_included >- rrp_tax_excluded >- unitprice >- unitprice_tax_included >- unitprice_tax_excluded >- sort1 >- ordernumber >- datecreated >- purchaseordernumber >- quantity >- claimed_date >- subscriptionid >- frameworkcode >- sort2 >- datecancellationprinted >- budget_id >- authorisedby >- booksellerid >- cancellationreason >-); >- >-# note that authorisedby was added to the return of SearchOrder by the >-# patch for bug 11777 > > my $invoiceid = AddInvoice( > invoicenumber => 'invoice', >@@ -684,23 +298,6 @@ my $search_orders = SearchOrders({ > basketno => $basketno > }); > isa_ok( $search_orders, 'ARRAY' ); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_orders( \@expectedfields, \@order_content, >- $search_orders ); >-is( >- $$test_nbr_fields[0], >- scalar @expectedfields, >- "SearchOrders gets orders with the right number of fields" >-); >-is( join( " ", @$test_missing_fields ), >- '', "SearchOrders gets orders with no missing fields" ); >-is( join( " ", @$test_extra_fields ), >- '', "SearchOrders gets orders with no unexpected fields" ); >-is( join( " ", @$test_different_fields ), >- '', "SearchOrders gets orders with the right content in every fields" ); > ok( > ( > ( scalar @$search_orders == 4 ) >@@ -755,34 +352,6 @@ is( scalar (@$search_orders), 0, "SearchOrders takes into account the biblionumb > ok( GetBudgetByOrderNumber( $ordernumbers[0] )->{'budget_id'} eq $budgetid, > "GetBudgetByOrderNumber returns expected budget" ); > >-# >-# Test GetLateOrders >-# >- >-@expectedfields = qw ( >- orderdate >- author >- budget >- supplierid >- claims_count >- supplier >- publisher >- ordernumber >- quantity >- basketno >- claimed_date >- branch >- estimateddeliverydate >- title >- publicationyear >- unitpricelib >- unitpricesupplier >- subtotal >- latesince >- basketname >- basketgroupid >- basketgroupname >-); > my @lateorders = GetLateOrders(0); > is( scalar grep ( $_->{basketno} eq $basketno, @lateorders ), > 0, "GetLateOrders does not get orders from opened baskets" ); >@@ -794,22 +363,6 @@ ok( !grep ( $_->{ordernumber} eq $ordernumbers[3], @lateorders ), > "GetLateOrders does not gets cancelled orders" ); > ok( !grep ( $_->{ordernumber} eq $ordernumbers[4], @lateorders ), > "GetLateOrders does not gets reveived orders" ); >-( >- $test_missing_fields, $test_extra_fields, >- $test_different_fields, $test_nbr_fields >- ) >- = _check_fields_of_orders( \@expectedfields, \@order_content, \@lateorders ); >-is( >- $$test_nbr_fields[0], >- scalar @expectedfields, >- "GetLateOrders gets orders with the right number of fields" >-); >-is( join( " ", @$test_missing_fields ), >- '', "GetLateOrders gets orders with no missing fields" ); >-is( join( " ", @$test_extra_fields ), >- '', "GetLateOrders gets orders with no unexpected fields" ); >-is( join( " ", @$test_different_fields ), >- '', "GetLateOrders gets orders with the right content in every fields" ); > > $search_orders = SearchOrders({ > booksellerid => $booksellerid, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17562
:
57249
|
57251
|
57396