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