PHP Classes

File: tests/Parser/Wsdl/TagRestrictionTest.php

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

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Parser\Wsdl;

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

class
TagRestrictionTest extends WsdlParser
{
   
/**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagRestriction
     */
   
public static function actonInstance()
    {
        return new
TagRestriction(self::generatorInstance(self::wsdlActonPath()));
    }
   
/**
     * @return \WsdlToPhp\PackageGenerator\Parser\Wsdl\TagRestriction
     */
   
public static function imageViewInstance()
    {
        return new
TagRestriction(self::generatorInstance(self::wsdlImageViewServicePath()));
    }
   
/**
     *
     */
   
public function testParseImageViewService()
    {
       
$tagRestrictionParser = self::imageViewInstance();

       
$tagRestrictionParser->parse();

       
$count = 0;
        foreach (
$tagRestrictionParser->getGenerator()->getStructs() as $struct) {
            if (
$struct instanceof Struct && $struct->getIsRestriction() === false) {
                if (
$struct->getName() === 'EchoRequestType') {
                   
$this->assertSame('string', $struct->getInheritance());
                   
$this->assertEquals(array('maxLength'=>'100'), $struct->getMeta());
                   
$count++;
                } elseif (
$struct->getName() === 'PasswordType') {
                   
$this->assertSame('string', $struct->getInheritance());
                   
$this->assertEquals(array('minLength'=>'5', 'maxLength'=>'10'), $struct->getMeta());
                   
$count++;
                }
            }
        }
       
$this->assertEquals(2, $count);
    }
   
/**
     *
     */
   
public function testParseActonService()
    {
       
$tagRestrictionParser = self::actonInstance();

       
$tagRestrictionParser->parse();

       
$ok = false;
        foreach (
$tagRestrictionParser->getGenerator()->getStructs() as $struct) {
            if (
$struct instanceof Struct) {
                if (
$struct->getName() === 'ID') {
                   
$this->assertFalse($struct->getIsStruct());
                   
$ok = true;
                }
            }
        }
       
$this->assertTrue($ok);
    }
}