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

(-)a/t/Serials/IssueNumber.t (-11 / +12 lines)
Lines 17-24 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 10;
20
use Test::More tests => 9;
21
use Test::Warn;
21
use Test::Warn;
22
use Test::Exception;
22
23
23
BEGIN {
24
BEGIN {
24
    use_ok('C4::Serials');
25
    use_ok('C4::Serials');
Lines 26-47 BEGIN { Link Here
26
27
27
my $dt = DateTime->new( year => 2017, month => 1, day => 1 );
28
my $dt = DateTime->new( year => 2017, month => 1, day => 1 );
28
29
29
eval { issue_number( '2017', 'day' ); };
30
throws_ok { C4::Serials::issue_number( '2017', 'day' ) }
30
is( ref($@), 'Koha::Exceptions::WrongParameter' );
31
'Koha::Exceptions::WrongParameter',
31
is( $@,      'Date passed to issue_number is not a valid DateTime object' );
32
    'Date passed to issue_number is not a valid DateTime object';
32
33
33
is( issue_number( $dt, 'day' ), 7, '2017-01-01 is the seventh day of week' );
34
is( C4::Serials::issue_number( $dt, 'day' ), 7, '2017-01-01 is the seventh day of week' );
34
35
35
is( issue_number( $dt, 'week' ), 52, '2017-01-01 is the week #52 of the year' );
36
is( C4::Serials::issue_number( $dt, 'week' ), 52, '2017-01-01 is the week #52 of the year' );
36
37
37
is( issue_number( $dt, 'month' ), 1, '2017-01-01 is the first month of the year' );
38
is( C4::Serials::issue_number( $dt, 'month' ), 1, '2017-01-01 is the first month of the year' );
38
39
39
$dt = DateTime->new( year => 2022, month => 9, day => 17 );
40
$dt = DateTime->new( year => 2022, month => 9, day => 17 );
40
41
41
is( issue_number( $dt, 'day' ), 6, '2022-09-17 is the sixth day of week' );
42
is( C4::Serials::issue_number( $dt, 'day' ), 6, '2022-09-17 is the sixth day of week' );
42
43
43
is( issue_number( $dt, 'week' ), 37, '2022-09-17 is the week #37 of the year' );
44
is( C4::Serials::issue_number( $dt, 'week' ), 37, '2022-09-17 is the week #37 of the year' );
44
45
45
is( issue_number( $dt, 'month' ), 9, '2022-09-17 is the ninth month of the year' );
46
is( C4::Serials::issue_number( $dt, 'month' ), 9, '2022-09-17 is the ninth month of the year' );
46
47
47
is( issue_number( $dt, 'foo' ), 0, 'issue_number return 0 for others issue type' );
48
is( C4::Serials::issue_number( $dt, 'foo' ), 0, 'issue_number return 0 for others issue type' );
(-)a/t/db_dependent/Koha/Subscription.t (-1 / +1 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::NoWarnings;
22
use Test::NoWarnings;
23
use Test::More tests => 11;
23
use Test::More tests => 12;
24
24
25
use Koha::Database;
25
use Koha::Database;
26
use Koha::Subscription;
26
use Koha::Subscription;
(-)a/t/db_dependent/Koha/Subscription/Irregularities.t (-5 / +10 lines)
Lines 85-91 my $subscription = $builder->build( Link Here
85
            firstacquidate         => '2018-05-07',
85
            firstacquidate         => '2018-05-07',
86
            irregularity           => '3;4',
86
            irregularity           => '3;4',
87
            permanent_irregularity => '3;4',
87
            permanent_irregularity => '3;4',
88
            numberpattern          => 7,
88
            numberpattern          => $number_pattern->{id},
89
            enddate                => '2018-05-13',
89
            enddate                => '2018-05-13',
90
            closed                 => 0
90
            closed                 => 0
91
        }
91
        }
Lines 182-191 $builder->build( Link Here
182
    }
182
    }
183
);
183
);
184
184
185
ReNewSubscription(
185
C4::Serials::ReNewSubscription(
186
    $subscription->{subscriptionid}, undef,
186
    {
187
    $subscription->{enddate},        $subscription->{numberlength},
187
        subscriptionid => $subscription->{subscriptionid},
188
    $subscription->{weeklength},     $subscription->{monthlength},
188
        user           => undef,
189
        startdate      => $subscription->{enddate},
190
        numberlength   => $subscription->{numberlength},
191
        weeklength     => $subscription->{weeklength},
192
        monthlength    => $subscription->{monthlength},
193
    }
189
);
194
);
190
195
191
my $s              = Koha::Subscriptions->find( $subscription->{subscriptionid} );
196
my $s              = Koha::Subscriptions->find( $subscription->{subscriptionid} );

Return to bug 17656