Bugzilla – Attachment 184519 Details for
Bug 16631
Show groups/categories of reports to authorized staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug 16631: 0012-Add-unit-tests-for-reports_branches-updates
0012-Add-unit-tests-for-reports_branches-updates.patch (text/plain), 2.31 KB, created by
Casey Conlin
on 2025-07-22 22:04:28 UTC
(
hide
)
Description:
Bug 16631: 0012-Add-unit-tests-for-reports_branches-updates
Filename:
MIME Type:
Creator:
Casey Conlin
Created:
2025-07-22 22:04:28 UTC
Size:
2.31 KB
patch
obsolete
>From 439bfedfb1d250bb99ef8daa1376573f7656685a Mon Sep 17 00:00:00 2001 >From: Casey Conlin <101153261+CaseyConlin@users.noreply.github.com> >Date: Sun, 13 Jul 2025 09:09:00 -0400 >Subject: [PATCH 12/16] Add unit tests for reports_branches updates. > >--- > t/db_dependent/Koha/Reports.t | 38 ++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Reports.t b/t/db_dependent/Koha/Reports.t >index 205b1df60a..9778357d87 100755 >--- a/t/db_dependent/Koha/Reports.t >+++ b/t/db_dependent/Koha/Reports.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 9; >+use Test::More tests => 10; > > use Koha::Report; > use Koha::Reports; >@@ -185,4 +185,40 @@ subtest '_might_add_limit' => sub { > ); > }; > >+subtest 'reports_branches are added and removed from report_branches table' => sub { >+ plan tests => 4; >+ >+ my $updated_nb_of_reports = Koha::Reports->search->count; >+ my $report = Koha::Report->new( >+ { >+ report_name => 'report_name_for_test_1', >+ savedsql => 'SELECT * FROM items WHERE itemnumber IN <<Test|list>>', >+ } >+ )->store; >+ >+ my $id = $report->id; >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my @branches = ( $library1->branchcode, $library2->branchcode, $library3->branchcode ); >+ >+ $report->replace_library_limits( \@branches ); >+ >+ my @branches_loop = $report->get_library_limits->as_list; >+ is( scalar @branches_loop, 3, '3 branches added to report_branches table' ); >+ >+ $report->replace_library_limits( [ $library1->branchcode, $library2->branchcode ] ); >+ >+ @branches_loop = $report->get_library_limits->as_list; >+ is( scalar @branches_loop, 2, '1 branch removed from report_branches table' ); >+ >+ $report->delete; >+ is( Koha::Reports->search->count, $updated_nb_of_reports, 'Report deleted, count is back to original' ); >+ is( >+ $schema->resultset('ReportsBranch')->search( { report_id => $id } )->count, >+ 0, >+ 'No branches left in reports_branches table after report deletion' >+ ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.39.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 Raw
Actions:
View
Attachments on
bug 16631
:
184422
|
184508
|
184509
|
184510
|
184511
|
184512
|
184513
|
184514
|
184515
|
184516
|
184517
|
184518
|
184519
|
184520
|
184521
|
184522
|
184525
|
184526
|
184657
|
184674
|
184686
|
184687
|
184688
|
184689
|
184690
|
184691
|
184692
|
184693
|
184694
|
184695
|
184845
|
184846
|
184847
|
184848
|
184859
|
184861