View | Details | Raw Unified | Return to bug 10332
Collapse All | Expand All

(-)a/C4/CourseReserves.pm (+1 lines)
Lines 77-82 This module deals with course reserves. Link Here
77
sub GetCourse {
77
sub GetCourse {
78
    my ($course_id) = @_;
78
    my ($course_id) = @_;
79
    warn whoami() . "( $course_id )" if $DEBUG;
79
    warn whoami() . "( $course_id )" if $DEBUG;
80
    return unless $course_id;
80
81
81
    my $query = "SELECT * FROM courses WHERE course_id = ?";
82
    my $query = "SELECT * FROM courses WHERE course_id = ?";
82
    my $dbh   = C4::Context->dbh;
83
    my $dbh   = C4::Context->dbh;
(-)a/t/db_dependent/CourseReserves.t (-5 / +4 lines)
Lines 5-12 Link Here
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
7
8
use Test::More tests => 20;
8
use Test::More tests => 21;
9
use Data::Dumper;
10
9
11
BEGIN {
10
BEGIN {
12
    use_ok('C4::Biblio');
11
    use_ok('C4::Biblio');
Lines 46-57 $course_id = ModCourse( Link Here
46
);
45
);
47
46
48
my $course = GetCourse($course_id);
47
my $course = GetCourse($course_id);
49
50
ok( $course->{'course_name'} eq "Test Course",       "GetCourse returned correct course" );
48
ok( $course->{'course_name'} eq "Test Course",       "GetCourse returned correct course" );
51
ok( $course->{'staff_note'}  eq "Test staff note 2", "ModCourse updated course succesfully" );
49
ok( $course->{'staff_note'}  eq "Test staff note 2", "ModCourse updated course succesfully" );
52
50
53
my $courses = GetCourses();
51
my $courses = GetCourses();
54
ok( $courses->[0]->{'course_name'} eq "Test Course", "GetCourses returns valid array of course data" );
52
is( ref($courses), 'ARRAY', "GetCourses returns an array" );
53
my @match = map {$_->{course_name} eq 'Test Course'} @$courses;
54
ok( scalar(@match) > 0, "GetCourses returns valid array of course data" );
55
55
56
ModCourseInstructors( mode => 'add', course_id => $course_id, borrowernumbers => [ $borrowers[0]->{'borrowernumber'} ] );
56
ModCourseInstructors( mode => 'add', course_id => $course_id, borrowernumbers => [ $borrowers[0]->{'borrowernumber'} ] );
57
$course = GetCourse($course_id);
57
$course = GetCourse($course_id);
58
- 

Return to bug 10332