spec\Phpro\SoapClient\CodeGenerator\TypeGeneratorSpec::it_generates_types PHP Метод

it_generates_types() публичный Метод

public it_generates_types ( Phpro\SoapClient\CodeGenerator\Rules\RuleSetInterface $ruleSet, Zend\Code\Generator\FileGenerator $file, ClassGenerator $class )
$ruleSet Phpro\SoapClient\CodeGenerator\Rules\RuleSetInterface
$file Zend\Code\Generator\FileGenerator
$class Zend\Code\Generator\ClassGenerator
    function it_generates_types(RuleSetInterface $ruleSet, FileGenerator $file, ClassGenerator $class)
    {
        $type = new Type('MyNamespace', 'MyType', ['prop1' => 'string']);
        $property = $type->getProperties()[0];
        $file->generate()->willReturn('code');
        $file->getClass()->willReturn($class);
        $class->setNamespaceName('MyNamespace')->shouldBeCalled();
        $class->setName('MyType')->shouldBeCalled();
        $file->setClass($class)->shouldBeCalled();
        $ruleSet->applyRules(Argument::that(function (ContextInterface $context) use($type) {
            return $context instanceof TypeContext && $context->getType() === $type;
        }))->shouldBeCalled();
        $ruleSet->applyRules(Argument::that(function (ContextInterface $context) use($type, $property) {
            return $context instanceof PropertyContext && $context->getType() === $type && $context->getProperty() === $property;
        }))->shouldBeCalled();
        $this->generate($file, $type)->shouldReturn('code');
    }