Bugzilla – Attachment 148522 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.84 KB, created by
ByWater Sandboxes
on 2023-03-22 12:28:34 UTC
(
hide
)
Description:
Bug 8179: Add tests
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-03-22 12:28:34 UTC
Size:
4.84 KB
patch
obsolete
>From f64ada0225c2397c85900d99e89cc076c9f13ea0 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 > >Sponsored-by: Virginia Polytechnic Institute and State University >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >--- > 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(-) > mode change 100755 => 100644 t/db_dependent/Koha/Item.t > >diff --git a/t/db_dependent/Koha/Acquisition/Fund.t b/t/db_dependent/Koha/Acquisition/Fund.t >index 38dae6297a..80c4e4e65a 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 => 2; >+use Test::More tests => 3; > > use t::lib::TestBuilder; > >@@ -43,6 +43,19 @@ 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; >+}; >+ > subtest 'budget' => sub { > plan tests => 1; > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 4d96e3b7d9..ea7afb0287 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; >@@ -622,6 +621,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 => 54; >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >old mode 100755 >new mode 100644 >index d9252ef3d8..5af5e70853 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 28; >+use Test::More tests => 29; > use Test::Exception; > use Test::MockModule; > >@@ -33,6 +33,8 @@ use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Old::Items; > use Koha::Recalls; >+use Koha::AuthorisedValueCategories; >+use Koha::AuthorisedValues; > > use List::MoreUtils qw(all); > >@@ -2124,3 +2126,34 @@ subtest 'is_denied_renewal' => 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.30.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 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