File: tests/Container/Model/ServiceContainerTest.php

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

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Container\Model;

use
WsdlToPhp\PackageGenerator\Model\Service;
use
WsdlToPhp\PackageGenerator\Container\Model\Service as ServiceContainer;
use
WsdlToPhp\PackageGenerator\Tests\TestCase;

class
ServiceContainerTest extends TestCase
{
   
/**
     * @return ServiceContainer
     */
   
public static function instance()
    {
       
$serviceContainer = new ServiceContainer(self::getBingGeneratorInstance());
       
$serviceContainer->add(new Service(self::getBingGeneratorInstance(), 'Foo'));
        return
$serviceContainer;
    }
   
/**
     *
     */
   
public function testGetServiceByName()
    {
       
$serviceContainer = self::instance();

       
$this->assertInstanceOf('\\WsdlToPhp\\PackageGenerator\\Model\\Service', $serviceContainer->getServiceByName('Foo'));
       
$this->assertNull($serviceContainer->getServiceByName('Bar'));
    }
   
/**
     *
     */
   
public function testAddServiceNonUnique()
    {
       
$serviceContainer = self::instance();

       
$serviceContainer->addService(self::getBingGeneratorInstance(), 'Foo', 'bar', 'string', 'int');
       
$serviceContainer->addService(self::getBingGeneratorInstance(), 'Foo', 'bar', 'int', 'string');

       
$fooService = $serviceContainer->getServiceByName('Foo');

       
$this->assertCount(2, $fooService->getMethods());

       
$count = 0;
        foreach (
$fooService->getMethods() as $method) {
           
$this->assertFalse($method->getIsUnique());
           
$count++;
        }
       
$this->assertSame(2, $count);
    }
}


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