Bug 16148 [Follow-up] Revised layout and behavior of marc modification template manag...
[koha.git] / t / Output.t
blob4474d18752dfcae3118ea5e790bdd757912e714c
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 use Test::More tests => 5;
7 use CGI qw ( -utf8 );
9 BEGIN {
10 use_ok('C4::Output');
13 my $query = CGI->new();
14 my $cookie;
15 my $output = 'foobarbaz';
18 local *STDOUT;
19 my $stdout;
20 open STDOUT, '>', \$stdout;
21 output_html_with_http_headers $query, $cookie, $output, undef, { force_no_caching => 1 };
22 like($stdout, qr/Cache-control: no-cache, no-store, max-age=0/, 'force_no_caching sets Cache-control as desired');
23 like($stdout, qr/Expires: /, 'force_no_caching sets an Expires header');
24 $stdout = '';
25 close STDOUT;
26 open STDOUT, '>', \$stdout;
27 output_html_with_http_headers $query, $cookie, $output, undef, undef;
28 like($stdout, qr/Cache-control: no-cache[^,]/, 'not using force_no_caching sets Cache-control as desired');
29 unlike($stdout, qr/Expires: /, 'force_no_caching does not set an Expires header');