Bugzilla – Attachment 112554 Details for
Bug 8179
Receiving multiple order lines at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8179: Add tests
Bug-8179-Add-tests.patch (text/plain), 4.48 KB, created by
Agustín Moyano
on 2020-10-27 11:01:29 UTC
(
hide
)
Description:
Bug 8179: Add tests
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-10-27 11:01:29 UTC
Size:
4.48 KB
patch
obsolete
>From bd82172b26ef3b0c663cd06781cdaa01e3f90ab4 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 9 Oct 2020 17:15:31 -0300 >Subject: [PATCH] Bug 8179: Add tests > >This patch adds tests in: >* t/db_dependent/Koha/Acquisition/Fund.t >* t/db_dependent/Koha/Acquisitoin/Order.t >* t/db_dependent/Koha/Item.t >--- > t/db_dependent/Koha/Acquisition/Fund.t | 15 ++++++++++- > t/db_dependent/Koha/Acquisition/Order.t | 18 +++++++++++-- > t/db_dependent/Koha/Item.t | 35 ++++++++++++++++++++++++- > 3 files changed, 64 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/Acquisition/Fund.t b/t/db_dependent/Koha/Acquisition/Fund.t >index 98ab1dcbf9..c9e66297b4 100755 >--- a/t/db_dependent/Koha/Acquisition/Fund.t >+++ b/t/db_dependent/Koha/Acquisition/Fund.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > > use t::lib::TestBuilder; > >@@ -42,3 +42,16 @@ subtest 'to_api() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'budget ()' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $budget = $builder->build_object({ class => 'Koha::Acquisition::Budgets' }); >+ my $fund = $builder->build_object({ class => 'Koha::Acquisition::Funds', value => { budget_period_id => $budget->budget_period_id } }); >+ >+ is($budget->budget_period_id, $fund->budget->budget_period_id, 'Fund\'s budget retrieved correctly'); >+ >+ $schema->storage->txn_rollback; >+}; >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 8919fe29af..cd3c3550e9 100755 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,8 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 12; >-use Test::Exception; >+use Test::More tests => 13; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -590,6 +589,21 @@ subtest 'filter_by_current & filter_by_cancelled' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'creator ()' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => { created_by => $patron->borrowernumber } }); >+ >+ my $creator = $order->creator; >+ >+ is($creator->borrowernumber, $patron->borrowernumber, 'Patron is order creator'); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'cancel() tests' => sub { > > plan tests => 52; >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 0309fa94f6..fa07a66057 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 7; >+use Test::More tests => 8; > > use C4::Biblio; > use C4::Circulation; >@@ -27,6 +27,8 @@ use C4::Circulation; > use Koha::Items; > use Koha::Database; > use Koha::Old::Items; >+use Koha::AuthorisedValueCategories; >+use Koha::AuthorisedValues; > > use List::MoreUtils qw(all); > >@@ -516,3 +518,34 @@ subtest 'Tests for itemtype' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest '_fetch_authorised_values' => sub { >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ # Delete all Authorised Values of 'Countries' category >+ Koha::AuthorisedValues->search({category => 'Countries'})->delete; >+ Koha::AuthorisedValueCategories->search({category_name => 'Countries'})->delete; >+ >+ # Create 'Countries' category and authorised value >+ my $cat = $builder->build_object({ class => 'Koha::AuthorisedValueCategories'}); >+ my $country = $builder->build_object({ class => 'Koha::AuthorisedValues', value => { category => $cat->category_name } }); >+ >+ # Create a new biblio framework >+ my $fw = $builder->build_object({ class => 'Koha::BiblioFrameworks' }); >+ >+ # Add a Marc subfield with kohafield setted to 'items.itemnote' >+ $builder->build_object({class => 'Koha::MarcSubfieldStructures', value => {frameworkcode => $fw->frameworkcode, authorised_value => $cat->category_name, kohafield => 'items.itemnotes'}}); >+ >+ # Create biblio and item >+ my $biblio = $builder->build_sample_biblio({frameworkcode => $fw->frameworkcode}); >+ my $item = $builder->build_sample_item({biblionumber => $biblio->biblionumber, itemnotes => $country->authorised_value}); >+ >+ # Fetch authorised values >+ my $avs = $item->_fetch_authorised_values(); >+ >+ is($avs->{itemnotes}->{lib}, $country->lib, 'Fetched auhtorised value is ok'); >+ >+ $schema->storage->txn_rollback; >+} >-- >2.25.0
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 8179
:
9881
|
111437
|
111438
|
111439
|
111440
|
112554
|
112555
|
112556
|
112558
|
112588
|
112643
|
112644
|
112645
|
112646
|
112744
|
112745
|
112746
|
112747
|
114688
|
114689
|
114690
|
114691
|
116582
|
116583
|
116584
|
116585
|
116588
|
116589
|
116590
|
116591
|
116681
|
116682
|
116683
|
116684
|
116942
|
116943
|
116944
|
116945
|
119178
|
119179
|
119180
|
119181
|
120620
|
120621
|
120622
|
120623
|
148215
|
148216
|
148217
|
148218
|
148233
|
148284
|
148285
|
148286
|
148287
|
148288
|
148521
|
148522
|
148523
|
148524
|
148525
|
148526
|
148685
|
148981
|
148982
|
148983
|
148984
|
148985
|
148986
|
151026
|
151086
|
151087
|
151088
|
151089
|
151092
|
151093
|
151137
|
151138
|
151139
|
151140
|
151141
|
151142
|
151143
|
151144
|
151145
|
151163
|
151250
|
151367
|
151431