File: tests/Parser/Wsdl/TagAttributeTest.php

Recommend this page to a friend!
  Classes of WsdlToPhp  >  PHP SOAP Package Generator  >  tests/Parser/Wsdl/TagAttributeTest.php  >  Download  
File: tests/Parser/Wsdl/TagAttributeTest.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:
Date: 5 years ago
Size: 3,531 bytes
 

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Parser\Wsdl;

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

class
TagAttributeTest extends WsdlParser
{
   
/**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagAttribute
     */
   
public static function ebayInstance()
    {
        return new
TagAttribute(self::generatorInstance(self::wsdlEbayPath()));
    }
   
/**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagAttribute
     */
   
public static function whlInstance()
    {
        return new
TagAttribute(self::generatorInstance(self::wsdlWhlPath()));
    }
   
/**
     *
     */
   
public function testParseEbay()
    {
       
$tagAttributeParser = self::ebayInstance();

       
$tagAttributeParser->parse();

       
$ok = false;
       
$structs = $tagAttributeParser->getGenerator()->getStructs();
        if (
$structs->count() > 0) {
            if (
$structs->getStructByName('QuantityType') instanceof Struct) {
               
$this->assertSame('token', $structs->getStructByName('QuantityType')->getAttribute('unit')->getType());
               
$this->assertSame(array('use'=>'optional'), $structs->getStructByName('QuantityType')->getAttribute('unit')->getMeta());
               
$ok = true;
            }
            if (
$structs->getStructByName('CharityIDType') instanceof Struct) {
               
$this->assertSame('CharityAffiliationTypeCodeType', $structs->getStructByName('CharityIDType')->getAttribute('type')->getType());
               
$this->assertSame(array('use'=>'required'), $structs->getStructByName('CharityIDType')->getAttribute('type')->getMeta());
               
$ok = true;
            }
            if (
$structs->getStructByName('CharityAffiliationType') instanceof Struct) {
               
$this->assertSame('string', $structs->getStructByName('CharityAffiliationType')->getAttribute('id')->getType());
               
$this->assertSame('CharityAffiliationTypeCodeType', $structs->getStructByName('CharityAffiliationType')->getAttribute('type')->getType());
               
$ok = true;
            }
        }
       
$this->assertTrue((bool)$ok);
    }
   
/**
     *
     */
   
public function testParseWhl()
    {
       
$tagAttributeParser = self::whlInstance();

       
$tagAttributeParser->parse();

       
$ok = false;
       
$structs = $tagAttributeParser->getGenerator()->getStructs();
        if (
$structs->count() > 0) {
            if (
$structs->getStructByName('DestinationType') instanceof Struct) {
               
$this->assertSame('integer', $structs->getStructByName('DestinationType')->getAttribute('ID')->getType());
               
$this->assertSame('integer', $structs->getStructByName('DestinationType')->getAttribute('CountryID')->getType());
               
$ok = true;
            }
            if (
$structs->getStructByName('InventoryType') instanceof Struct) {
               
$this->assertSame('string', $structs->getStructByName('InventoryType')->getAttribute('RatePlanId')->getType());
               
$this->assertSame('string', $structs->getStructByName('InventoryType')->getAttribute('Availability')->getType());
               
$this->assertSame('string', $structs->getStructByName('InventoryType')->getAttribute('StartDate')->getType());
               
$this->assertSame('string', $structs->getStructByName('InventoryType')->getAttribute('EndDate')->getType());
               
$ok = true;
            }
        }
       
$this->assertTrue((bool)$ok);
    }
}


For more information send a message to info at phpclasses dot org.