lib/SOAP/Test.pm

filter: Statementstmt 10.9% 22 / 201 Branchbran 5.0% 2 / 40 Conditioncond 1.7% 1 / 57 MC/DCmcdc 0.0% 0 / 36 Subroutinesub 42.8% 6 / 14 Podpod n/a totaltotal 8.9% 31 / 348 CC 42 SCAR 69.6
CC
42
Cov
8%
run_for
1454.9
new
6.0
__ANON__
6.0
CRAP 1058.9
↑ Summary lib/SOAP/Transport/HTTP.pm »
1 # ======================================================================
2 #
3 # Copyright (C) 2000-2001 Paul Kulchenko (paulclinger@yahoo.com)
4 # SOAP::Lite is free software; you can redistribute it
5 # and/or modify it under the same terms as Perl itself.
6 #
7 # ======================================================================
8  
9 package SOAP::Test;
10  
11 11 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 our $VERSION = 1.12;
13  
14 11 our $TIMEOUT = 5;
15  
16 # ======================================================================
17  
18 package My::PingPong; # we'll use this package in our tests
19  
20 sub new {
21 0 ▶ my $self = shift;
Subroutine new: not called CC=2 SCAR=17.9
22 0 ▶ my $class = ref($self) || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
23 0 bless {_num=>shift} => $class;
24 }
25  
26 sub next {
27 0 ▶ my $self = shift;
Subroutine next: not called CC=1 SCAR=6.9
28 0 $self->{_num}++;
29 }
30  
31 sub value {
32 0 ▶ my $self = shift;
Subroutine value: not called CC=1 SCAR=6.9
33 0 $self->{_num};
34 }
35  
36 # ======================================================================
37  
38 package SOAP::Test::Server;
39  
40 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 11 ▶use Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 11 ▶use SOAP::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 sub run_for {
45 6 ▶ my $proxy = shift or die "Proxy/endpoint is not specified";
Subroutine run_for: called CC=40 SCAR=72.8
Branch: 1 branch
BranchTrueFalseTotal
my $proxy = shift() or die "Proxy/endpoint is not specified" 0 6 6
46  
47 # ------------------------------------------------------
48 6 ▶ my $s = SOAP::Lite->uri('http://something/somewhere')->proxy($proxy)->on_fault(sub{});
Subroutine __ANON__: called CC=1 SCAR=0.0
49 6 eval { $s->transport->timeout($SOAP::Test::TIMEOUT) };
50 6 my $r = $s->test_connection;
51  
52 6 ▶ unless (defined $r && defined $r->envelope) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $r and defined $r->envelope) 6 0 6
Condition33%1/3
defined $r and defined $r->envelope
!ll&&!rl&&r
600
MC/DC0%0/2
defined $r and defined $r->envelope
defined $r defined $r->envelope
Truth table33%1/3
A and B
A= defined $rB= defined $r->envelope
ABresult
0X0
100
111
53 6 print "1..0 # Skip: ", $s->transport->status, "\n";
54 6 exit;
55 }
56 # ------------------------------------------------------
57  
58 0 plan tests => 53;
59  
60 0 ▶ eval q!use SOAP::Lite on_fault => sub{ref $_[1] ? $_[1] : new SOAP::SOM}; 1! or die;
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite on_fault => sub{ref \$_[1] ? \$_[1] : new SOAP::SOM}; 1" or die 0 0 0
61  
62 0 print STDERR "Perl SOAP server test(s)...\n";
63  
64 0 $s = SOAP::Lite
65 -> uri('urn:/My/Examples')
66 -> proxy($proxy);
67  
68 0 ok($s->getStateName(1)->result eq 'Alabama');
69 0 ok($s->getStateNames(1,4,6,13)->result =~ /^Alabama\s+Arkansas\s+Colorado\s+Illinois\s*$/);
70  
71 0 $r = $s->getStateList([1,2,3,4])->result;
72 0 ▶ ok(ref $r && $r->[0] eq 'Alabama');
Condition0%0/3
ref $r && $r->[0] eq 'Alabama'
!ll&&!rl&&r
000
MC/DC0%0/2
ref $r && $r->[0] eq 'Alabama'
ref $r $r->[0] eq 'Alabama'
Truth table0%0/3
A && B
A= ref $rB= $r->[0] eq 'Alabama'
ABresult
0X0
100
111
73  
74 0 $r = $s->getStateStruct({item1 => 1, item2 => 4})->result;
75 0 ▶ ok(ref $r && $r->{item2} eq 'Arkansas');
Condition0%0/3
ref $r && $r->{'item2'} eq 'Arkansas'
!ll&&!rl&&r
000
MC/DC0%0/2
ref $r && $r->{'item2'} eq 'Arkansas'
ref $r $r->{'item2'} eq 'Arkansas'
Truth table0%0/3
A && B
A= ref $rB= $r->{'item2'} eq 'Arkansas'
ABresult
0X0
100
111
76 0 print $s->transport->status, "\n";
77 {
78 0 my $autoresult = $s->autoresult;
79 0 $s->autoresult(1);
80 0 ok($s->getStateName(1) eq 'Alabama');
81 0 $s->autoresult($autoresult);
82 }
83  
84 0 print STDERR "Autobinding of output parameters test(s)...\n";
85  
86 0 $s->uri('urn:/My/Parameters');
87 0 my $param1 = 10;
88 0 my $param2 = SOAP::Data->name('myparam' => 12);
89 0 my $result = $s->autobind($param1, $param2)->result;
90 0 ▶ ok($result == $param1 && $param2->value == 24);
Condition0%0/3
$result == $param1 && $param2->value == 24
!ll&&!rl&&r
000
MC/DC0%0/2
$result == $param1 && $param2->value == 24
$result == $param1 $param2->value == 24
Truth table0%0/3
A && B
A= $result == $param1B= $param2->value == 24
ABresult
0X0
100
111
91  
92 0 print STDERR "Header manipulation test(s)...\n";
93 0 $a = $s->addheader(2, SOAP::Header->name(my => 123));
94 0 ▶ ok(ref $a->header && $a->header->{my} eq '123123');
Condition0%0/3
ref $a->header && $a->header->{'my'} eq '123123'
!ll&&!rl&&r
000
MC/DC0%0/2
ref $a->header && $a->header->{'my'} eq '123123'
ref $a->header $a->header->{'my'} eq '123123'
Truth table0%0/3
A && B
A= ref $a->headerB= $a->header->{'my'} eq '123123'
ABresult
0X0
100
111
95 0 ok($a->headers eq '123123');
96  
97 0 print STDERR "Echo untyped data test(s)...\n";
98 0 $a = $s->echotwo(11, 12);
99 0 ok($a->result == 11);
100  
101 0 print STDERR "mustUnderstand test(s)...\n";
102 0 $s->echo(SOAP::Header->name(somethingelse => 123)
103 ->mustUnderstand(1));
104 0 ok($s->call->faultstring =~ /[Hh]eader has mustUnderstand attribute/);
105  
106 0 ▶ if ($proxy =~ /^http/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proxy =~ /^http/) { } 0 0 0
107 0 ok($s->transport->status =~ /^500/);
108 } else {
109 0 skip('No Status checks for non http protocols on server side' => undef);
110 }
111  
112 0 $s->echo(SOAP::Header->name(somethingelse => 123)
113 ->mustUnderstand(1)
114 ->actor('http://notme/'));
115 0 ok(!defined $s->call->fault);
116  
117 0 print STDERR "dispatch_from test(s)...\n";
118 0 ▶ eval "use SOAP::Lite
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite\n uri => 'http://my.own.site.com/My/Examples',\n dispatch_from => ['A', 'B'],\n proxy => '${proxy}',\n ; 1" or die 0 0 0
119 uri => 'http://my.own.site.com/My/Examples',
120 dispatch_from => ['A', 'B'],
121 proxy => '$proxy',
122 ; 1" or die;
123  
124 0 eval { C->c };
125 0 ok($@ =~ /Can't locate object method "c"/);
126  
127 0 eval { A->a };
128 0 ▶ ok(!$@ && SOAP::Lite->self->call->faultstring =~ /Failed to access class \(A\)/);
Condition0%0/3
!$@ && 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
!ll&&!rl&&r
000
MC/DC0%0/2
!$@ && 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
!$@ 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
Truth table0%0/3
not(A) && B
A= !$@B= 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
ABresult
0X0
100
111
129  
130 0 ▶ eval "use SOAP::Lite
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite\n dispatch_from => 'A',\n uri => 'http://my.own.site.com/My/Examples',\n proxy => '${proxy}',\n ; 1" or die 0 0 0
131 dispatch_from => 'A',
132 uri => 'http://my.own.site.com/My/Examples',
133 proxy => '$proxy',
134 ; 1" or die;
135  
136 0 eval { A->a };
137 0 ▶ ok(!$@ && SOAP::Lite->self->call->faultstring =~ /Failed to access class \(A\)/);
Condition0%0/3
!$@ && 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
!ll&&!rl&&r
000
MC/DC0%0/2
!$@ && 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
!$@ 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
Truth table0%0/3
not(A) && B
A= !$@B= 'SOAP::Lite'->self->call->faultstring =~ /Failed to access class \(A\)/
ABresult
0X0
100
111
138  
139 0 print STDERR "Object autobinding and SOAP:: prefix test(s)...\n";
140  
141 0 ▶ eval "use SOAP::Lite +autodispatch =>
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite +autodispatch =>\n uri => 'urn:', proxy => '${proxy}'; 1" or die 0 0 0
142 uri => 'urn:', proxy => '$proxy'; 1" or die;
143  
144 0 ok(SOAP::Lite->autodispatched);
145  
146 0 eval { SOAP->new(1) };
147 0 ok($@ =~ /^URI is not specified/);
148  
149 0 ▶ eval "use SOAP::Lite +autodispatch =>
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite +autodispatch =>\n uri => 'urn:/A/B', proxy => '${proxy}'; 1" or die 0 0 0
150 uri => 'urn:/A/B', proxy => '$proxy'; 1" or die;
151  
152 # should call My::PingPong, not A::B
153 0 my $p = My::PingPong->SOAP::new(10);
154 0 ▶ ok(ref $p && $p->SOAP::next+1 == $p->value);
Condition0%0/3
ref $p && $p->SOAP::next + 1 == $p->value
!ll&&!rl&&r
000
MC/DC0%0/2
ref $p && $p->SOAP::next + 1 == $p->value
ref $p $p->SOAP::next + 1 == $p->value
Truth table0%0/3
A && B
A= ref $pB= $p->SOAP::next + 1 == $p->value
ABresult
0X0
100
111
155  
156 # forget everything
157 0 SOAP::Lite->self(undef);
158  
159 0 $s = SOAP::Lite
160 -> uri('urn:/My/PingPong')
161 -> proxy($proxy)
162 ;
163  
164 # should return object EXACTLY as after My::PingPong->SOAP::new(10)
165 0 $p = $s->SOAP::new(10);
166 0 ▶ ok(ref $p && $s->SOAP::next($p)+1 == $p->value);
Condition0%0/3
ref $p && $s->SOAP::next($p) + 1 == $p->value
!ll&&!rl&&r
000
MC/DC0%0/2
ref $p && $s->SOAP::next($p) + 1 == $p->value
ref $p $s->SOAP::next($p) + 1 == $p->value
Truth table0%0/3
A && B
A= ref $pB= $s->SOAP::next($p) + 1 == $p->value
ABresult
0X0
100
111
167  
168 0 print STDERR "VersionMismatch test(s)...\n";
169  
170 {
171 0 local $SOAP::Constants::NS_ENV = 'http://schemas.xmlsoap.org/new/envelope/';
172 my $s = SOAP::Lite
173 -> uri('http://my.own.site.com/My/Examples')
174 -> proxy($proxy)
175 ▶ -> on_fault(sub{})
Subroutine __ANON__: not called CC=1 SCAR=0.0
176 0 ;
177 0 $r = $s->dosomething;
178 0 ▶ ok(ref $r && $r->faultcode =~ /:VersionMismatch/);
Condition0%0/3
ref $r && $r->faultcode =~ /:VersionMismatch/
!ll&&!rl&&r
000
MC/DC0%0/2
ref $r && $r->faultcode =~ /:VersionMismatch/
ref $r $r->faultcode =~ /:VersionMismatch/
Truth table0%0/3
A && B
A= ref $rB= $r->faultcode =~ /:VersionMismatch/
ABresult
0X0
100
111
179 }
180  
181 0 print STDERR "Objects-by-reference test(s)...\n";
182  
183 0 ▶ eval "use SOAP::Lite +autodispatch =>
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite +autodispatch =>\n uri => 'urn:', proxy => '${proxy}'; 1" or die 0 0 0
184 uri => 'urn:', proxy => '$proxy'; 1" or die;
185  
186 0 print STDERR "Session iterator\n";
187 0 $r = My::SessionIterator->new(10);
188 0 ▶ if (!ref $r || exists $r->{id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $r or exists $r->{'id'}) { } 0 0 0
Condition0%0/3
not ref $r or exists $r->{"id"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $r or exists $r->{"id"}
not ref $r exists $r->{"id"}
Truth table0%0/3
not(A) or B
A= not ref $rB= exists $r->{"id"}
ABresult
1X1
011
000
189 0 ▶ ok(ref $r && $r->next && $r->next == 11);
Condition0%0/6
ref $r && $r->next && $r->next == 11
!ll&&!rl&&r
000
ref $r and $r->next
!ll&&!rl&&r
000
MC/DC0%0/3
ref $r && $r->next && $r->next == 11
ref $r $r->next $r->next == 11
Truth table0%0/4
A and B && C
A= ref $rB= $r->nextC= $r->next == 11
ABCresult
0XX0
10X0
1100
1111
190 } else {
191 0 skip('No persistent objects (o-b-r) supported on server side' => undef);
192 }
193  
194 0 print STDERR "Persistent iterator\n";
195 0 $r = My::PersistentIterator->new(10);
196 0 ▶ if (!ref $r || exists $r->{id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $r or exists $r->{'id'}) { } 0 0 0
Condition0%0/3
not ref $r or exists $r->{"id"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $r or exists $r->{"id"}
not ref $r exists $r->{"id"}
Truth table0%0/3
not(A) or B
A= not ref $rB= exists $r->{"id"}
ABresult
1X1
011
000
197 0 ▶ my $first = ($r->next, $r->next) if ref $r;
Branch: 1 branch
BranchTrueFalseTotal
if ref $r 0 0 0
198  
199 0 $r = My::PersistentIterator->new(10);
200 0 ▶ ok(ref $r && $r->next && $r->next == $first+2);
Condition0%0/6
ref $r && $r->next && $r->next == $first + 2
!ll&&!rl&&r
000
ref $r and $r->next
!ll&&!rl&&r
000
MC/DC0%0/3
ref $r && $r->next && $r->next == $first + 2
ref $r $r->next $r->next == $first + 2
Truth table0%0/4
A and B && C
A= ref $rB= $r->nextC= $r->next == $first + 2
ABCresult
0XX0
10X0
1100
1111
201 } else {
202 0 skip('No persistent objects (o-b-r) supported on server side' => undef);
203 }
204  
205 0 { local $^W; # disable warnings about deprecated AUTOLOADing for nonmethods
206 0 print STDERR "Parameters-by-name test(s)...\n";
207 0 ▶ print STDERR "You can see warning about AUTOLOAD for non-method...\n" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
208  
209 0 ▶ eval "use SOAP::Lite +autodispatch =>
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite +autodispatch =>\n uri => 'http://my.own.site.com/My/Parameters', proxy => '${proxy}'; 1" or die 0 0 0
210 uri => 'http://my.own.site.com/My/Parameters', proxy => '$proxy'; 1" or die;
211  
212 0 my @parameters = (
213 SOAP::Data->name(b => 222),
214 SOAP::Data->name(c => 333),
215 SOAP::Data->name(a => 111)
216 );
217  
218 # switch to 'main' package, because nonqualified methods should be there
219 0 ok(main::byname(@parameters) eq "a=111, b=222, c=333");
220  
221 0 ok(main::bynameororder(@parameters) eq "a=111, b=222, c=333");
222  
223 0 ok(main::bynameororder(111, 222, 333) eq "a=111, b=222, c=333");
224  
225 0 print STDERR "Function call test(s)...\n";
226 0 ▶ print STDERR "You can see warning about AUTOLOAD for non-method...\n" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
227 0 ok(main::echo(11) == 11);
228 }
229  
230 0 print STDERR "SOAPAction test(s)...\n";
231 0 ▶ if ($proxy =~ /^tcp:/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proxy =~ /^tcp:/) { } 0 0 0
232 0 for (1..2) {skip('No SOAPAction checks for tcp: protocol on server side' => undef)}
233 } else {
234 my $s = SOAP::Lite
235 -> uri('http://my.own.site.com/My/Examples')
236 -> proxy($proxy)
237 0 ▶ -> on_action(sub{'""'})
Subroutine __ANON__: not called CC=1 SCAR=6.9
238 0 ;
239 0 ok($s->getStateName(1)->result eq 'Alabama');
240  
241 0 ▶ $s->on_action(sub{'"wrong_SOAPAction_here"'});
Subroutine __ANON__: not called CC=1 SCAR=6.9
242 0 ok($s->getStateName(1)->faultstring =~ /SOAPAction shall match/);
243 }
244  
245 0 print STDERR "UTF8 test(s)...\n";
246 0 ▶ if (!eval "pack('U*', 0)") {
Branch: 1 branch
BranchTrueFalseTotal
if (not eval q[pack('U*', 0)]) { } 0 0 0
247 0 for (1) {skip('No UTF8 test. No support for pack("U*") modifier' => undef)}
248 } else {
249 0 $s = SOAP::Lite
250 -> uri('http://my.own.site.com/My/Parameters')
251 -> proxy($proxy);
252  
253 0 my $latin1 = '�ਢ��';
254 0 my $utf8 = pack('U*', unpack('C*', $latin1));
255 0 my $result = $s->echo(SOAP::Data->type(string => $utf8))->result;
256  
257 0 ▶ ok(pack('U*', unpack('C*', $result)) eq $utf8 # should work where XML::Parser marks resulting strings as UTF-8
Condition0%0/3
pack('U*', unpack('C*', $result)) eq $utf8 || join('', unpack('C*', $result)) eq join('', unpack('C*', $utf8))
l!l&&r!l&&!r
000
MC/DC0%0/2
pack('U*', unpack('C*', $result)) eq $utf8 || join('', unpack('C*', $result)) eq join('', unpack('C*', $utf8))
pack('U*', unpack('C*', $result)) eq $utf8 join('', unpack('C*', $result)) eq join('', unpack('C*', $utf8))
Truth table0%0/3
A || B
A= pack('U*', unpack('C*', $result)) eq $utf8B= join('', unpack('C*', $result)) eq join('', unpack('C*', $utf8))
ABresult
1X1
011
000
258 || join('', unpack('C*', $result)) eq join('', unpack('C*', $utf8)) # should work where it doesn't
259 );
260 }
261  
262 {
263 0 my $on_fault_was_called = 0;
264 0 print STDERR "Die in server method test(s)...\n";
265 my $s = SOAP::Lite
266 -> uri('http://my.own.site.com/My/Parameters')
267 -> proxy($proxy)
268 0 ▶ -> on_fault(sub{$on_fault_was_called++;return})
Subroutine __ANON__: not called CC=1 SCAR=6.9
269 0 ;
270 0 ok($s->die_simply()->faultstring =~ /Something bad/);
271 0 ok($on_fault_was_called > 0);
272 0 my $detail = $s->die_with_object()->dataof(SOAP::SOM::faultdetail . '/[1]');
273 0 ok($on_fault_was_called > 1);
274 0 ▶ ok(ref $detail && $detail->name =~ /(^|:)something$/);
Condition0%0/3
ref $detail && $detail->name =~ /(^|:)something$/
!ll&&!rl&&r
000
MC/DC0%0/2
ref $detail && $detail->name =~ /(^|:)something$/
ref $detail $detail->name =~ /(^|:)something$/
Truth table0%0/3
A && B
A= ref $detailB= $detail->name =~ /(^|:)something$/
ABresult
0X0
100
111
275  
276 # get Fault as hash of subelements
277 0 my $fault = $s->die_with_fault()->fault;
278 0 ok($fault->{faultcode} =~ ':Server.Custom');
279 0 ok($fault->{faultstring} eq 'Died in server method');
280 0 ok(ref $fault->{detail}->{BadError} eq 'BadError');
281 0 ok($fault->{faultactor} eq 'http://www.soaplite.com/custom');
282 }
283  
284 0 print STDERR "Method with attributes test(s)...\n";
285  
286 0 $s = SOAP::Lite
287 -> uri('urn:/My/Examples')
288 -> proxy($proxy)
289 ;
290  
291 0 ok($s->call(SOAP::Data->name('getStateName')->attr({xmlns => 'urn:/My/Examples'}), 1)->result eq 'Alabama');
292  
293 0 print STDERR "Call with empty uri test(s)...\n";
294 0 $s = SOAP::Lite
295 -> uri('')
296 -> proxy($proxy)
297 ;
298  
299 0 ok($s->getStateName(1)->faultstring =~ /Denied access to method \(getStateName\) in class \(main\)/);
300  
301 0 ok($s->call('a:getStateName' => 1)->faultstring =~ /Denied access to method \(getStateName\) in class \(main\)/);
302  
303 0 print STDERR "Number of parameters test(s)...\n";
304  
305 0 $s = SOAP::Lite
306 -> uri('http://my.own.site.com/My/Parameters')
307 -> proxy($proxy)
308 ;
309 0 { my @all = $s->echo->paramsall; ok(@all == 0) }
310 0 { my @all = $s->echo(1)->paramsall; ok(@all == 1) }
311 0 { my @all = $s->echo((1) x 10)->paramsall; ok(@all == 10) }
312  
313 0 print STDERR "Memory refresh test(s)...\n";
314  
315 # Funny test.
316 # Let's forget about ALL settings we did before with 'use SOAP::Lite...'
317 0 SOAP::Lite->self(undef);
318 0 ok(!defined SOAP::Lite->self);
319  
320 0 print STDERR "Call without uri test(s)...\n";
321 0 $s = SOAP::Lite
322 -> proxy($proxy)
323 ;
324  
325 0 ok($s->getStateName(1)->faultstring =~ /Denied access to method \(getStateName\) in class \(main\)/);
326  
327 0 print STDERR "Different settings for method and namespace test(s)...\n";
328  
329 0 ok($s->call(SOAP::Data
330 ->name('getStateName')
331 ->attr({xmlns => 'urn:/My/Examples'}), 1)->result eq 'Alabama');
332  
333 0 ok($s->call(SOAP::Data
334 ->name('a:getStateName')
335 ->uri('urn:/My/Examples'), 1)->result eq 'Alabama');
336  
337 0 ok($s->call(SOAP::Data
338 ->name('getStateName')
339 ->uri('urn:/My/Examples'), 1)->result eq 'Alabama');
340  
341 0 ok($s->call(SOAP::Data
342 ->name('a:getStateName')
343 ->attr({'xmlns:a' => 'urn:/My/Examples'}), 1)->result eq 'Alabama');
344  
345 0 eval { $s->call(SOAP::Data->name('a:getStateName')) };
346  
347 0 ok($@ =~ /Can't find namespace for method \(a:getStateName\)/);
348  
349 0 $s->serializer->namespaces->{'urn:/My/Examples'} = '';
350  
351 0 ok($s->getStateName(1)->result eq 'Alabama');
352  
353 0 ▶ eval "use SOAP::Lite
Branch: 1 branch
BranchTrueFalseTotal
eval "use SOAP::Lite\n uri => 'urn:/My/Examples', proxy => '${proxy}'; 1" or die 0 0 0
354 uri => 'urn:/My/Examples', proxy => '$proxy'; 1" or die;
355  
356 0 print STDERR "Global settings test(s)...\n";
357 0 $s = new SOAP::Lite;
358  
359 0 ok($s->getStateName(1)->result eq 'Alabama');
360  
361 SOAP::Trace->import(transport =>
362 0 ▶ sub {$_[0]->content_type('something/wrong') if UNIVERSAL::isa($_[0] => 'HTTP::Request')}
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($_[0], "HTTP::Request") 0 0 0
363 0 );
364  
365 0 ▶ if ($proxy =~ /^tcp:/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proxy =~ /^tcp:/) { } 0 0 0
366 0 skip('No Content-Type checks for tcp: protocol on server side' => undef);
367 } else {
368 0 ok($s->getStateName(1)->faultstring =~ /Content-Type must be/);
369 }
370 }
371  
372 # ======================================================================
373  
374 11 1;
375  
376 __END__
↑ Summary lib/SOAP/Transport/HTTP.pm »