PHP Classes

File: tests/Parser/Wsdl/TagElementTest.php

Recommend this page to a friend!
  Classes of WsdlToPhp   PHP SOAP Package Generator   tests/Parser/Wsdl/TagElementTest.php   Download  
File: tests/Parser/Wsdl/TagElementTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP SOAP Package Generator
Generate package to call SOAP services using WSDL
Author: By
Last change: issue #41 - add property to StructAttribute ot define if it's an array
It defined if this StructAttribute can contain elements of its type or not,
by this way we'll be able to know if we have to handle an array
for this attribute or if its a simple value/object, it can be the two cases
at the same time meaning that the attribute is only a simple value/object or is only an array
Date: 8 years ago
Size: 2,065 bytes
 

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Parser\Wsdl;

use
WsdlToPhp\PackageGenerator\Parser\Wsdl\TagElement;
use
WsdlToPhp\PackageGenerator\Model\Struct;

class
TagElementTest extends WsdlParser
{
   
/**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagElement
     */
   
public static function bingInstance()
    {
        return new
TagElement(self::generatorInstance(self::wsdlBingPath()));
    }
   
/**
     *
     */
   
public function testParseBing()
    {
       
$tagElementParser = self::bingInstance();

       
$tagElementParser->parse();

       
$ok = 0;
       
$structs = $tagElementParser->getGenerator()->getStructs();
        if (
$structs->count() > 0) {
            if (
$structs->getStructByName('SearchRequest') instanceof Struct) {
               
$this->assertSame(array(
                   
'default' => '2.2',
                   
'maxOccurs' => '1',
                   
'minOccurs' => '0',
                ),
$structs->getStructByName('SearchRequest')->getAttribute('Version')->getMeta());
               
$this->assertSame('string', $structs->getStructByName('SearchRequest')->getAttribute('Version')->getType());
               
$this->assertFalse($structs->getStructByName('SearchRequest')->getAttribute('Version')->getContainsElements());
               
$ok++;
            }
            if (
$structs->getStructByName('ArrayOfNewsRelatedSearch') instanceof Struct) {
               
$this->assertSame(array(
                   
'maxOccurs' => 'unbounded',
                   
'minOccurs' => '0',
                ),
$structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getMeta());
               
$this->assertSame('NewsRelatedSearch', $structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getType());
               
$this->assertTrue($structs->getStructByName('ArrayOfNewsRelatedSearch')->getAttribute('NewsRelatedSearch')->getContainsElements());
               
$ok++;
            }
        }
       
$this->assertEquals(2, $ok);
    }
}