Bug 19135: Restore AllowHoldsOnPatronsPossessions behaviour
[koha.git] / t / Output_JSONStream.t
blob13702a65f6ecfcdaa3b0dfa641c2664499221080
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
9 use Test::More tests => 10;
11 BEGIN {
12 use_ok('C4::Output::JSONStream');
15 my $json = new C4::Output::JSONStream;
16 is($json->output,'{}',"Making sure JSON output is blank just after its created.");
17 $json->param( issues => [ 'yes!', 'please', 'no' ] );
18 is($json->output,'{"issues":["yes!","please","no"]}',"Making sure JSON output has added what we told it to.");
19 $json->param( stuff => ['realia'] );
20 like($json->output,'/"stuff":\["realia"\]/',"Making sure JSON output has added more params correctly.");
21 like($json->output,'/"issues":\["yes!","please","no"\]/',"Making sure existing elements remain in JSON output");
22 $json->param( stuff => ['fun','love'] );
23 like($json->output,'/"stuff":\["fun","love"\]/',"Making sure JSON output can overwrite params.");
24 like($json->output,'/"issues":\["yes!","please","no"\]/',"Making non overwitten elements remain in JSON output");
26 eval{$json->param( die )};
27 ok($@,'Dies');
29 eval{$json->param( die => ['yes','sure','now'])};
30 ok(!$@,'Does not die.');
31 eval{$json->param( die => ['yes','sure','now'], die2 =>)};
32 ok($@,'Dies.');