Bugzilla – Attachment 43876 Details for
Bug 14778
DBIC should create/own the DB handler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14778: Remove t/Acquisition/Invoices.t
PASSED-QA-Bug-14778-Remove-tAcquisitionInvoicest.patch (text/plain), 5.56 KB, created by
Kyle M Hall (khall)
on 2015-10-23 14:57:21 UTC
(
hide
)
Description:
[PASSED QA] Bug 14778: Remove t/Acquisition/Invoices.t
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-23 14:57:21 UTC
Size:
5.56 KB
patch
obsolete
>From 2c10e27b02cd9ef5e30f58ec6812241e8e9b18b6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Oct 2015 15:42:53 +0100 >Subject: [PATCH] [PASSED QA] Bug 14778: Remove t/Acquisition/Invoices.t > >Using Test::DBIx::Class now, we cannot do what we did in this file with DBD::Mock. >Since the Invoice[s] subroutines are already tested in >t/db_dependent/Acquisition/Invoices.t there is no special needs to have >these ones. >Instead of loosing 2 hours on this file, I would prefer to remove it. >Feel free to provide a counter patch. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/Acquisition/Invoice.t | 153 ----------------------------------------------- > 1 files changed, 0 insertions(+), 153 deletions(-) > delete mode 100755 t/Acquisition/Invoice.t > >diff --git a/t/Acquisition/Invoice.t b/t/Acquisition/Invoice.t >deleted file mode 100755 >index aa1172d..0000000 >--- a/t/Acquisition/Invoice.t >+++ /dev/null >@@ -1,153 +0,0 @@ >-#!/usr/bin/perl >- >-use Modern::Perl; >-use C4::Context; >- >-use Test::More tests => 50; >-use Test::MockModule; >- >-my $module = new Test::MockModule('C4::Context'); >-$module->mock('_new_dbh', sub { >- my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >- || die "Cannot create handle: $DBI::errstr\n"; >- return $dbh; >-}); >- >-my $dbh = C4::Context->dbh; >- >-use_ok('C4::Acquisition'); >- >-# We need to add a resultset to avoid DBI fail >-# ("DBI bind_columns: invalid number of arguments...") >-my $rs = [ >- [qw(one two three four)], >- [1, 2, 3, 4] >-]; >- >-$dbh->{mock_add_resultset} = $rs; >-my @invoices = C4::Acquisition::GetInvoices( >- supplierid => "supplierid", >- invoicenumber => "invoicenumber", >- suppliername => "suppliername", >- shipmentdatefrom => "shipmentdatefrom", >- shipmentdateto => "shipmentdateto", >- billingdatefrom => "billingdatefrom", >- billingdateto => "billingdateto", >- isbneanissn => "isbneanissn", >- title => "title", >- author => "author", >- publisher => "publisher", >- publicationyear => "publicationyear", >- branchcode => "branchcode", >-); >-my $history = $dbh->{mock_all_history}; >- >-ok(scalar(@$history) > 0); >-my @bound_params = @{ $history->[-1]->{bound_params} }; >-is(scalar(@bound_params), 16); >-is($bound_params[0], 'supplierid'); >-is($bound_params[1], '%invoicenumber%'); >-is($bound_params[2], '%suppliername%'); >-is($bound_params[3], 'shipmentdatefrom'); >-is($bound_params[4], 'shipmentdateto'); >-is($bound_params[5], 'billingdatefrom'); >-is($bound_params[6], 'billingdateto'); >-is($bound_params[7], 'isbneanissn'); >-is($bound_params[8], 'isbneanissn'); >-is($bound_params[9], 'isbneanissn'); >-is($bound_params[10], 'title'); >-is($bound_params[11], 'author'); >-is($bound_params[12], 'publisher'); >-is($bound_params[13], 'publicationyear'); >-is($bound_params[14], 'publicationyear'); >-is($bound_params[15], 'branchcode'); >- >-$dbh->{mock_clear_history} = 1; >-$dbh->{mock_add_resultset} = $rs; >-GetInvoice(42); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 1); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 1); >-is($bound_params[0], 42); >- >-$dbh->{mock_clear_history} = 1; >-$dbh->{mock_add_resultset} = $rs; >-$dbh->{mock_add_resultset} = $rs; >-my $invoice = GetInvoiceDetails(42); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 2); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 1); >-is($bound_params[0], 42); >-@bound_params = @{ $history->[1]->{bound_params} }; >-is(scalar(@bound_params), 1); >-is($bound_params[0], 42); >-ok(exists $invoice->{orders}); >- >-$dbh->{mock_clear_history} = 1; >-is(AddInvoice(booksellerid => 1), undef); # Fails because of a missing parameter >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 0); >- >-$dbh->{mock_clear_history} = 1; >-AddInvoice(invoicenumber => 'invoice', booksellerid => 1, unknown => "unknown"); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 1); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 2); >-ok(grep /^1$/, @bound_params); >-ok(grep /^invoice$/, @bound_params); >-ok(not grep /unknown/, @bound_params); >- >-$dbh->{mock_clear_history} = 1; >-is(ModInvoice(booksellerid => 1), undef); # Fails because of a missing parameter >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 0); >- >-$dbh->{mock_clear_history} = 1; >-ModInvoice(invoiceid => 3, invoicenumber => 'invoice', unknown => "unknown"); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 1); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 2); >-ok(grep /^3$/, @bound_params); >-ok(grep /^invoice$/, @bound_params); >-ok(not grep /unknown/, @bound_params); >- >-$dbh->{mock_clear_history} = 1; >-CloseInvoice(42); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 1); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 1); >-is($bound_params[0], 42); >- >-$dbh->{mock_clear_history} = 1; >-ReopenInvoice(42); >-$history = $dbh->{mock_all_history}; >-is(scalar(@$history), 1); >-@bound_params = @{ $history->[0]->{bound_params} }; >-is(scalar(@bound_params), 1); >-is($bound_params[0], 42); >-my $checkordersrs = [ >- [qw(COUNT)], >- [2] >-]; >- >-$dbh->{mock_add_resultset} = $checkordersrs; >-is(DelInvoice(42), undef, "Invoices with items don't get deleted"); >- >-$checkordersrs = [ >- [qw(COUNT)], >- [0] >-]; >- >-my $deleters = [ >- [qw(COUNT)], >- [1] >-]; >- >-$dbh->{mock_add_resultset} = $checkordersrs; >-$dbh->{mock_add_resultset} = $deleters; >-ok(DelInvoice(42), "Invoices without items do get deleted"); >-- >1.7.2.5
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 14778
:
42326
|
42388
|
43247
|
43248
|
43249
|
43250
|
43440
|
43631
|
43632
|
43633
|
43634
|
43635
|
43636
|
43637
|
43638
|
43639
|
43640
|
43641
|
43642
|
43643
|
43644
|
43645
|
43834
|
43835
|
43836
|
43837
|
43838
|
43839
|
43840
|
43841
|
43842
|
43843
|
43844
|
43845
|
43846
|
43847
|
43848
|
43849
|
43850
|
43851
|
43852
|
43853
|
43857
|
43858
|
43859
|
43860
|
43861
|
43862
|
43863
|
43864
|
43865
|
43866
|
43867
|
43868
|
43869
|
43870
|
43871
|
43872
|
43873
|
43874
|
43875
| 43876 |
44003