Bugzilla – Attachment 169279 Details for
Bug 28762
Item status shows incorrectly on course-details.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28762: Add test for new 'instructors' accessor
Bug-28762-Add-test-for-new-instructors-accessor.patch (text/plain), 2.61 KB, created by
Martin Renvoize
on 2024-07-22 12:30:51 UTC
(
hide
)
Description:
Bug 28762: Add test for new 'instructors' accessor
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-07-22 12:30:51 UTC
Size:
2.61 KB
patch
obsolete
>From 3e95869d0efb642e6acdeacae7b96d0fc0620952 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 29 Jan 2024 09:41:08 +0000 >Subject: [PATCH] Bug 28762: Add test for new 'instructors' accessor > >--- > t/db_dependent/Koha/Course.t | 67 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > create mode 100755 t/db_dependent/Koha/Course.t > >diff --git a/t/db_dependent/Koha/Course.t b/t/db_dependent/Koha/Course.t >new file mode 100755 >index 00000000000..af23e03d549 >--- /dev/null >+++ b/t/db_dependent/Koha/Course.t >@@ -0,0 +1,67 @@ >+#!/usr/bin/perl >+ >+# Copyright 2024 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+ >+use Koha::Course; >+use Koha::Courses; >+use Koha::Course::Instructor; >+use Koha::Course::Instructors; >+use Koha::Database; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'relationship tests' => sub { >+ plan tests => 1; >+ >+ subtest 'intructors' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $course = $builder->build_object( { class => 'Koha::Courses' } ); >+ >+ my $instructors = $course->instructors; >+ is( ref($instructors), 'Koha::Patrons', '->instructors returns a Koha::Patrons object' ); >+ is( $instructors->count, 0, '->instructors->count returns 0 when there are no instructors associated' ); >+ >+ foreach my $i ( 0 .. 3 ) { >+ >+ my $instructor = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ Koha::Course::Instructor->new( >+ { >+ course_id => $course->course_id, >+ borrowernumber => $instructor->borrowernumber, >+ } >+ )->store(); >+ } >+ >+ $instructors = $course->instructors; >+ is( $instructors->count, 4, '4 instructors returns' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+}; >-- >2.45.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 28762
:
123233
|
123234
|
123236
|
123237
|
124661
|
124666
|
124667
|
124668
|
124744
|
125220
|
125228
|
125229
|
125233
|
161563
|
161564
|
161565
|
161566
|
161567
|
161568
|
161569
|
161570
|
161571
|
161572
|
161573
|
161574
|
161584
|
161585
|
161586
|
161587
|
161588
|
161589
|
161590
|
161591
|
163310
|
163311
|
163312
|
163313
|
163314
|
163315
|
163316
|
163317
|
165843
|
165844
|
165845
|
165846
|
165847
|
165848
|
165849
|
165850
|
169172
|
169273
|
169274
|
169275
|
169276
|
169277
|
169278
|
169279
|
169280
|
169281
|
169311
|
169312
|
169313
|
169314
|
169354
|
169355
|
169356
|
169357
|
169358
|
169359
|
169360
|
169361
|
169362
|
169363
|
169364
|
169365
|
169366
|
169367
|
169393