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

(-)a/t/db_dependent/Budgets.t (-1 lines)
Lines 8-14 use C4::Context; Link Here
8
use C4::Biblio;
8
use C4::Biblio;
9
use C4::Bookseller;
9
use C4::Bookseller;
10
use C4::Acquisition;
10
use C4::Acquisition;
11
use C4::Dates;
12
use C4::Members qw( AddMember );
11
use C4::Members qw( AddMember );
13
12
14
use Koha::Acquisition::Order;
13
use Koha::Acquisition::Order;
(-)a/t/db_dependent/Holds.t (-1 / +2 lines)
Lines 133-140 ModReserve({ Link Here
133
    rank          => '4',
133
    rank          => '4',
134
    branchcode    => $branch_1,
134
    branchcode    => $branch_1,
135
    itemnumber    => $itemnumber,
135
    itemnumber    => $itemnumber,
136
    suspend_until => C4::Dates->new("2013-01-01","iso")->output(),
136
    suspend_until => output_pref( { dt => dt_from_string( "2013-01-01", "iso" ), dateonly => 1 } ),
137
});
137
});
138
138
$reserve = GetReserve( $reserve_id );
139
$reserve = GetReserve( $reserve_id );
139
ok( $reserve->{'priority'} eq '4', "Test GetReserve(), priority changed correctly" );
140
ok( $reserve->{'priority'} eq '4', "Test GetReserve(), priority changed correctly" );
140
ok( $reserve->{'suspend'}, "Test GetReserve(), suspend hold" );
141
ok( $reserve->{'suspend'}, "Test GetReserve(), suspend hold" );
(-)a/t/db_dependent/Koha_template_plugin_KohaDates.t (-5 / +1 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Context;
4
use C4::Context;
5
use C4::Dates;
5
use Koha::DateUtils;
6
use Test::More tests => 7;
6
use Test::More tests => 7;
7
use Test::MockModule;
7
use Test::MockModule;
8
8
Lines 14-27 my $module_context = new Test::MockModule('C4::Context'); Link Here
14
14
15
my $date = "1973-05-21";
15
my $date = "1973-05-21";
16
my $context = C4::Context->new();
16
my $context = C4::Context->new();
17
my $dateobj = C4::Dates->new();
18
17
19
my $filter = Koha::Template::Plugin::KohaDates->new();
18
my $filter = Koha::Template::Plugin::KohaDates->new();
20
ok ($filter, "new()");
19
ok ($filter, "new()");
21
20
22
$context->set_preference( "dateformat", 'iso' );
21
$context->set_preference( "dateformat", 'iso' );
23
$context->clear_syspref_cache();
22
$context->clear_syspref_cache();
24
$dateobj->reset_prefformat;
25
23
26
my $filtered_date = $filter->filter($date);
24
my $filtered_date = $filter->filter($date);
27
is ($filtered_date,$date, "iso conversion") or diag ("iso conversion fails");
25
is ($filtered_date,$date, "iso conversion") or diag ("iso conversion fails");
Lines 29-42 is ($filtered_date,$date, "iso conversion") or diag ("iso conversion fails"); Link Here
29
#$filter = Koha::Template::Plugin::KohaDates->new();
27
#$filter = Koha::Template::Plugin::KohaDates->new();
30
$context->set_preference( "dateformat", 'us' );
28
$context->set_preference( "dateformat", 'us' );
31
$context->clear_syspref_cache();
29
$context->clear_syspref_cache();
32
$dateobj->reset_prefformat;
33
30
34
$filtered_date = $filter->filter($date);
31
$filtered_date = $filter->filter($date);
35
is ($filtered_date,'05/21/1973', "us conversion") or diag ("us conversion fails $filtered_date");
32
is ($filtered_date,'05/21/1973', "us conversion") or diag ("us conversion fails $filtered_date");
36
33
37
$context->set_preference( "dateformat", 'metric' );
34
$context->set_preference( "dateformat", 'metric' );
38
$context->clear_syspref_cache();
35
$context->clear_syspref_cache();
39
$dateobj->reset_prefformat;
40
36
41
$filtered_date = $filter->filter($date);
37
$filtered_date = $filter->filter($date);
42
is ($filtered_date,'21/05/1973', "metric conversion") or diag ("metric conversion fails $filtered_date");
38
is ($filtered_date,'21/05/1973', "metric conversion") or diag ("metric conversion fails $filtered_date");
(-)a/t/db_dependent/Log.t (-4 / +4 lines)
Lines 8-16 use strict; Link Here
8
use warnings;
8
use warnings;
9
use Test::More tests => 7;
9
use Test::More tests => 7;
10
10
11
# We need C4::Dates to handle the dates
12
use C4::Dates;
13
use C4::Context;
11
use C4::Context;
12
use Koha::DateUtils;
13
14
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog
14
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog
15
use Data::Dumper;
15
use Data::Dumper;
16
16
Lines 43-50 ok($success, "GetLogs returns results for an open search"); Link Here
43
43
44
eval {
44
eval {
45
    # FIXME: US formatted date hardcoded into test for now
45
    # FIXME: US formatted date hardcoded into test for now
46
    my $date = C4::Dates->new();
46
    my $date = output_pref( { dt => dt_from_string, datenonly => 1, dateformat => 'iso' } );
47
    $success = scalar(@{GetLogs($date->today(),$date->today(),"",undef,undef,"","")});
47
    $success = scalar(@{GetLogs( $date, $date, "", undef, undef, "", "") } );
48
} or do {
48
} or do {
49
    diag($@);
49
    diag($@);
50
    $success = 0;
50
    $success = 0;
(-)a/t/db_dependent/NewsChannels.t (-6 / +6 lines)
Lines 1-8 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use C4::Dates qw(format_date);
5
use C4::Branch qw(GetBranchName);
4
use C4::Branch qw(GetBranchName);
5
use Koha::DateUtils;
6
6
use Test::More tests => 10;
7
use Test::More tests => 10;
7
8
8
BEGIN {
9
BEGIN {
Lines 81-90 $rv = upd_opac_new($href_entry2); Link Here
81
ok( $rv == 1, 'Successfully updated second dummy news item!' );
82
ok( $rv == 1, 'Successfully updated second dummy news item!' );
82
83
83
# Test get_opac_new (single news item)
84
# Test get_opac_new (single news item)
84
$timestamp1      = format_date($timestamp1);
85
$timestamp1      = output_pref( { dt => dt_from_string( $timestamp1 ), dateonly => 1, dateformat => 'iso' } );
85
$expirationdate1 = format_date($expirationdate1);
86
$expirationdate1 = output_pref( { dt => dt_from_string( $expirationdate1 ), dateonly => 1, dateformat => 'iso' } );
86
$timestamp2      = format_date($timestamp2);
87
$timestamp2      = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1, dateformat => 'iso' } );
87
$expirationdate2 = format_date($expirationdate2);
88
$expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1, dateformat => 'iso' } );
88
89
89
is_deeply(
90
is_deeply(
90
    get_opac_new($idnew1),
91
    get_opac_new($idnew1),
91
- 

Return to bug 14977