Bugzilla – Attachment 67645 Details for
Bug 15685
Allow creation of items (AcqCreateItem) to be customizable per-basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15685: (QA followup) Tidy tests
Bug-15685-QA-followup-Tidy-tests.patch (text/plain), 4.76 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-10-05 15:26:01 UTC
(
hide
)
Description:
Bug 15685: (QA followup) Tidy tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-10-05 15:26:01 UTC
Size:
4.76 KB
patch
obsolete
>From 870718b60978a98c2406a4116d7baab822848c91 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 5 Oct 2017 11:12:57 -0300 >Subject: [PATCH] Bug 15685: (QA followup) Tidy tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Acquisition/Basket.t | 73 ++++++++++++++++++++++---------- > 1 file changed, 51 insertions(+), 22 deletions(-) > >diff --git a/t/db_dependent/Koha/Acquisition/Basket.t b/t/db_dependent/Koha/Acquisition/Basket.t >index 0ba7367a98..8965c891b0 100644 >--- a/t/db_dependent/Koha/Acquisition/Basket.t >+++ b/t/db_dependent/Koha/Acquisition/Basket.t >@@ -18,34 +18,63 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 8; >-use Koha::Database; >+ >+use Test::More tests => 3; > use t::lib::TestBuilder; > use t::lib::Mocks; >+ > use C4::Acquisition; >+use Koha::Database; > > use_ok('Koha::Acquisition::Basket'); > use_ok('Koha::Acquisition::Baskets'); > >-my $schema = Koha::Database->schema; >-$schema->storage->txn_begin; >-my $dbh = C4::Context->dbh; >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'create_items + effective_create_items tests' => sub { > >-# Start transaction >-$dbh->{RaiseError} = 1; >+ plan tests => 7; > >-my $builder = t::lib::TestBuilder->new; >-my $basket = $builder->build_object({ class => 'Koha::Acquisition::Baskets', value => { create_items => undef } }); >-my $created_basketno = C4::Acquisition::NewBasket($basket->booksellerid, $basket->authorisedby, $basket->basketname,$basket->note, $basket->booksellernote, $basket->contractnumber, $basket->deliveryplace, $basket->billingplace, $basket->is_standing, $basket->create_items); >-my $created_basket = Koha::Acquisition::Baskets->find({ basketno => $created_basketno }); >-is($created_basket->basketno, $created_basketno, "Basket created by NewBasket matches db basket"); >-is( $basket->create_items, undef, "Create items value can be null"); >-t::lib::Mocks::mock_preference('AcqCreateItem', 'cataloguing'); >-is( $basket->effective_create_items, "cataloguing","We use AcqCreateItem if basket create items is not set"); >-C4::Acquisition::ModBasketHeader($basket->basketno, $basket->basketname, $basket->note, $basket->booksellernote, $basket->contractnumber, $basket->booksellerid, $basket->deliveryplace, $basket->billingplace, $basket->is_standing, "ordering"); >-my $retrieved_basket = Koha::Acquisition::Baskets->find({ basketno => $basket->basketno }); >-$basket->create_items("ordering"); >-is( $retrieved_basket->create_items, "ordering", "Should be able to set with ModBasketHeader"); >-is( $basket->create_items, "ordering", "Should be able to set with object methods"); >-is_deeply($retrieved_basket->unblessed, $basket->unblessed, "Correct basket found and updated"); >-is( $retrieved_basket->effective_create_items, "ordering","We use basket create items if it is set"); >+ $schema->storage->txn_begin; >+ >+ my $basket = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ value => { create_items => undef } >+ } >+ ); >+ my $created_basketno = C4::Acquisition::NewBasket( >+ $basket->booksellerid, $basket->authorisedby, >+ $basket->basketname, $basket->note, >+ $basket->booksellernote, $basket->contractnumber, >+ $basket->deliveryplace, $basket->billingplace, >+ $basket->is_standing, $basket->create_items >+ ); >+ my $created_basket = Koha::Acquisition::Baskets->find($created_basketno); >+ is( $created_basket->basketno, $created_basketno, >+ "Basket created by NewBasket matches db basket" ); >+ is( $basket->create_items, undef, "Create items value can be null" ); >+ >+ t::lib::Mocks::mock_preference( 'AcqCreateItem', 'cataloguing' ); >+ is( $basket->effective_create_items, >+ "cataloguing", >+ "We use AcqCreateItem if basket create items is not set" ); >+ C4::Acquisition::ModBasketHeader( >+ $basket->basketno, $basket->basketname, >+ $basket->note, $basket->booksellernote, >+ $basket->contractnumber, $basket->booksellerid, >+ $basket->deliveryplace, $basket->billingplace, >+ $basket->is_standing, "ordering" >+ ); >+ my $retrieved_basket = Koha::Acquisition::Baskets->find( $basket->basketno ); >+ $basket->create_items("ordering"); >+ is( $retrieved_basket->create_items, "ordering", "Should be able to set with ModBasketHeader" ); >+ is( $basket->create_items, "ordering", "Should be able to set with object methods" ); >+ is_deeply( $retrieved_basket->unblessed, >+ $basket->unblessed, "Correct basket found and updated" ); >+ is( $retrieved_basket->effective_create_items, >+ "ordering", "We use basket create items if it is set" ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.14.2
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 15685
:
47783
|
55094
|
55096
|
57390
|
57392
|
57395
|
57424
|
57425
|
57426
|
57427
|
64918
|
64919
|
64920
|
64921
|
64922
|
65119
|
65120
|
65121
|
65122
|
65895
|
65896
|
65897
|
65898
|
65899
|
65900
|
66119
|
66120
|
66121
|
66122
|
66123
|
66124
|
67638
|
67639
|
67640
|
67641
|
67642
|
67643
|
67644
|
67645
|
67646
|
67647
|
67689
|
67690
|
67691
|
67692
|
67693
|
67694
|
67695
|
67696
|
67697
|
67698
|
67884
|
67898
|
67899
|
67900
|
67901
|
67902
|
67903
|
67904
|
67905
|
67906
|
67907
|
67908
|
67909
|
67910
|
67911