File: Enumeration.t

package info (click to toggle)
libsoap-wsdl-perl 3.004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (31 lines) | stat: -rw-r--r-- 957 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use Test::More tests => 3; #qw(no_plan);

use_ok qw(SOAP::WSDL::XSD::Enumeration);

use SOAP::WSDL::Expat::WSDLParser;
my $parser = SOAP::WSDL::Expat::WSDLParser->new();

my $xml = q{<s:schema elementFormDefault="qualified"
    targetNamespace="urn:HelloWorld" xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns="urn:HelloWorld">
    <s:simpleType name="test">
        <s:restriction base="s:string">
            <s:enumeration value="foo"/>
            <s:enumeration value="bar">
                <s:annotation>
                    <s:documentation>foobar</s:documentation>
                </s:annotation>
            </s:enumeration>
        </s:restriction>
    </s:simpleType>
</s:schema>
};

my $schema = $parser->parse($xml);

is $schema->find_type('urn:HelloWorld', 'test')
    ->get_enumeration()->[0]->get_value(), 'foo';
is $schema->find_type('urn:HelloWorld', 'test')
    ->get_enumeration()->[1]->get_value(), 'bar';