PHP Classes

File: tests/Model/ModelTest.php

Recommend this page to a friend!
  Classes of WsdlToPhp  >  PHP SOAP Package Generator  >  tests/Model/ModelTest.php  >  Download  
File: tests/Model/ModelTest.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: 6 years ago
Size: 2,277 bytes
 

Contents

Class file image Download
<?php

namespace WsdlToPhp\PackageGenerator\Tests\Model;

use
WsdlToPhp\PackageGenerator\Tests\TestCase;
use
WsdlToPhp\PackageGenerator\Model\EmptyModel;

class
ModelTest extends TestCase
{
   
/**
     * @param string $name
     * @return \WsdlToPhp\PackageGenerator\Model\EmptyModel
     */
   
public static function instance($name)
    {
        return new
EmptyModel(self::getBingGeneratorInstance(), $name);
    }
   
/**
     *
     */
   
public function testGetCleanName()
    {
       
$this->assertEquals('_foo_', self::instance('-foo-')->getCleanName());
       
$this->assertEquals('_foo_', self::instance('-foo-----')->getCleanName(false));
       
$this->assertEquals('___foo', self::instance('---foo')->getCleanName(true));
       
$this->assertEquals('_foo', self::instance('___%_foo')->getCleanName(false));
       
$this->assertEquals('_foo_245', self::instance('___%_foo----245')->getCleanName(false));
    }
   
/**
     *
     */
   
public function testNameIsClean()
    {
       
$this->assertTrue(self::instance('foo_')->nameIsClean());
       
$this->assertTrue(self::instance('foo_54')->nameIsClean());
       
$this->assertFalse(self::instance('%foo_')->nameIsClean());
       
$this->assertFalse(self::instance('-foo_')->nameIsClean());
       
$this->assertFalse(self::instance('foo_')->nameIsClean());
    }
   
/**
     *
     */
   
public function testGetDocSubPackages()
    {
       
$this->assertEmpty(self::instance('Foo')->getDocSubPackages());
    }
   
/**
     * @expectedException \InvalidArgumentException
     */
   
public function testExceptionOnAddMetaName()
    {
       
self::instance('foo')->addMeta(null, 'bar');
    }
   
/**
     * @expectedException \InvalidArgumentException
     */
   
public function testExceptionOnAddMetaValue()
    {
       
self::instance('foo')->addMeta('', new \stdClass());
    }
   
/**
     *
     */
   
public function testAddMeta()
    {
       
$instance = self::instance('foo');

       
$instance->addMeta('foo', array(
           
'bar' => 1,
        ));
       
$instance->addMeta('foo', 'bar');

       
$this->assertSame(array(
           
'foo' => array(
               
'bar' => 1,
               
'bar',
            ),
        ),
$instance->getMeta());
    }
}

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