6 use Test::More tests => 6;
14 my $query = CGI->new();
16 my $output = 'foobarbaz';
21 open STDOUT, '>', \$stdout;
22 output_html_with_http_headers $query, $cookie, $output, undef, { force_no_caching => 1 };
23 like($stdout, qr/Cache-control: no-cache, no-store, max-age=0/, 'force_no_caching sets Cache-control as desired');
24 like($stdout, qr/Expires: /, 'force_no_caching sets an Expires header');
27 open STDOUT, '>', \$stdout;
28 output_html_with_http_headers $query, $cookie, $output, undef, undef;
29 like($stdout, qr/Cache-control: no-cache[^,]/, 'not using force_no_caching sets Cache-control as desired');
30 unlike($stdout, qr/Expires: /, 'force_no_caching does not set an Expires header');
33 subtest 'parametrized_url' => sub {
36 my $url = 'https://somesite.com/search?q={TITLE}&author={AUTHOR}{SUFFIX}';
37 my $subs = { TITLE => '_title_', AUTHOR => undef, ISBN => '123456789' };
39 warning_is { $res = C4::Output::parametrized_url( $url, $subs ) }
40 q{}, 'No warning expected on undefined author';
41 is( $res, 'https://somesite.com/search?q=_title_&author=',
42 'Title replaced, author empty and SUFFIX removed' );