PHP Classes

File: tests/Container/Model/StructContainerTest.php

Recommend this page to a friend!
  Classes of WsdlToPhp   PHP SOAP Package Generator   tests/Container/Model/StructContainerTest.php   Download  
File: tests/Container/Model/StructContainerTest.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: 1,925 bytes
 

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Container\Model;

use
WsdlToPhp\PackageGenerator\Tests\Model\StructTest;
use
WsdlToPhp\PackageGenerator\Container\Model\Struct as StructContainer;
use
WsdlToPhp\PackageGenerator\Tests\TestCase;

class
StructContainerTest extends TestCase
{
   
/**
     * @return StructContainer
     */
   
public static function instance()
    {
       
$structContainer = new StructContainer(self::getBingGeneratorInstance());
       
$structContainer->add(StructTest::instance('Foo', true));
       
$structContainer->add(StructTest::instance('Bar', false));
        return
$structContainer;
    }
   
/**
     *
     */
   
public function testGetStructByName()
    {
       
$structContainer = self::instance();

       
$this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\Model\\Struct', $structContainer->getStructByName('Foo'));
       
$this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\Model\\Struct', $structContainer->getStructByName('Bar'));
       
$this->assertNull($structContainer->getStructByName('bar'));
    }
   
/**
     *
     */
   
public function testAddStructWithSameAttributeName()
    {
       
$structContainer = self::instance();

       
$structContainer->addStructWithAttribute(self::getBingGeneratorInstance(), 'Foo', 'bar', 'string');
       
$structContainer->addStructWithAttribute(self::getBingGeneratorInstance(), 'Foo', 'bar', 'int');

       
$this->assertCount(1, $structContainer->getStructByName('Foo')->getAttributes());
    }
   
/**
     *
     */
    
public function testOffsetUnset()
     {
        
$instance = self::instance();

        
$instance->addStructWithAttribute(self::getBingGeneratorInstance(), 'Foo', 'bar', 'string');
        
$instance->addStructWithAttribute(self::getBingGeneratorInstance(), 'Foo', 'bar', 'int');

        
$instance->offsetUnset(1);

        
$this->assertNull($instance->offsetGet(1));
     }
}