Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 32; |
5 |
use Test::More tests => 33; |
6 |
use CGI; |
6 |
use CGI; |
7 |
use File::Basename; |
7 |
use File::Basename; |
8 |
use File::Spec; |
8 |
use File::Spec; |
Lines 121-123
for my $pass ( 1 .. 2 ) {
Link Here
|
121 |
is( @$info, 0, "Table $table does no longer exist" ); |
121 |
is( @$info, 0, "Table $table does no longer exist" ); |
122 |
ok( !( -f $full_pm_path ), "Koha::Plugins::Handler::delete works correctly." ); |
122 |
ok( !( -f $full_pm_path ), "Koha::Plugins::Handler::delete works correctly." ); |
123 |
} |
123 |
} |
124 |
- |
124 |
|
|
|
125 |
subtest 'output and output_html tests' => sub { |
126 |
|
127 |
plan tests => 6; |
128 |
|
129 |
# Trick stdout to be able to test |
130 |
local *STDOUT; |
131 |
my $stdout; |
132 |
open STDOUT, '>', \$stdout; |
133 |
|
134 |
my $plugin = Koha::Plugin::Test->new({ enable_plugins => 1, cgi => CGI->new }); |
135 |
$plugin->test_output; |
136 |
|
137 |
like($stdout, qr/Cache-control: no-cache/, 'force_no_caching sets Cache-control as desired'); |
138 |
like($stdout, qr{Content-Type: application/json; charset=UTF-8}, 'Correct content-type'); |
139 |
like($stdout, qr{¡Hola output!}, 'Correct data'); |
140 |
|
141 |
# reset the stdout buffer |
142 |
$stdout = ''; |
143 |
close STDOUT; |
144 |
open STDOUT, '>', \$stdout; |
145 |
|
146 |
$plugin->test_output_html; |
147 |
|
148 |
like($stdout, qr/Cache-control: no-cache/, 'force_no_caching sets Cache-control as desired'); |
149 |
like($stdout, qr{Content-Type: text/html; charset=UTF-8}, 'Correct content-type'); |
150 |
like($stdout, qr{¡Hola output_html!}, 'Correct data'); |
151 |
}; |