File: tests/Component/AbstractComponent.php

Recommend this page to a friend!
  Classes of WsdlToPhp  >  PHP Code Generator  >  tests/Component/AbstractComponent.php  >  Download  
File: tests/Component/AbstractComponent.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP Code Generator
Generate PHP code elements programatically
Author: By
Last change: upgrade source in order to use most of PHP 7.2 features
refactor sources and tests
add feature to PHP CS settings
Date: 1 year ago
Size: 814 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
WsdlToPhp\PhpGenerator\Tests\Component;

use
WsdlToPhp\PhpGenerator\Tests\TestCase;
use
WsdlToPhp\PhpGenerator\Component\AbstractComponent as AbstractComponentComponent;

class
AbstractComponent extends TestCase
{
    public function
assertSameContent($function, AbstractComponentComponent $component)
    {
       
$class = get_called_class();
       
$filename = sprintf(__DIR__ . '/../resources/%s_%s.php', implode('', array_slice(explode('\\', $class), -1, 1)), substr($function, 4));
        if (!
is_file($filename)) {
            throw new \
InvalidArgumentException(sprintf('Unable to locate "%s" content file for function "%s::%s"', $filename, $class, $function));
        }
       
$this->assertSame(file_get_contents($filename), $component->toString());
    }
}


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