File Coverage

File:t/Output_JSONStream.t
Coverage:100.0%

linestmtbrancondsubtimecode
1#!/usr/bin/perl
2#
3# This Koha test module is a stub!
4# Add more tests here!!!
5
6
1
1
1
1.33283536371043e+15
9
33
use strict;
7
1
1
1
11
7
42
use warnings;
8
9
1
1
1
156
19266
67
use Test::More tests => 8;
10
11BEGIN {
12
1
1774
        use_ok('C4::Output::JSONStream');
13}
14
15
1
241258
my $json = new C4::Output::JSONStream;
16
1
24
is($json->output,'{}',"Making sure JSON output is blank just after its created.");
17
1
658
$json->param( issues => [ 'yes!', 'please', 'no' ] );
18
1
11
is($json->output,'{"issues":["yes!","please","no"]}',"Making sure JSON output has added what we told it to.");
19
1
1118
$json->param( stuff => ['realia'] );
20
1
5
is($json->output,'{"issues":["yes!","please","no"],"stuff":["realia"]}',"Making sure JSON output has added more params correctly.");
21
1
524
$json->param( stuff => ['fun','love'] );
22
1
6
is($json->output,'{"issues":["yes!","please","no"],"stuff":["fun","love"]}',"Making sure JSON output can obverwrite params.");
23
24
1
1
539
10
eval{$json->param( die )};
25
1
10
ok($@,'Dies');
26
27
1
1
407
10
eval{$json->param( die => ['yes','sure','now'])};
28
1
6
ok(!$@,'Dosent die.');
29
1
1
398
8
eval{$json->param( die => ['yes','sure','now'], die2 =>)};
30
1
7
ok($@,'Dies.');