/** * {@inheritDoc} * * @param InputInterface $input * @param OutputInterface $output * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var DialogHelper $dialog */ $dialog = $this->getHelperSet()->get('dialog'); $wsdl = Validators::validateWsdl($input->getOption('wsdl')); $dir = Validators::validateTargetDir($input->getOption('dir')); $namespace = Validators::validateNamespace($input->getOption('namespace')); $licensePath = Validators::validateLicensePath($input->getOption('license-path')); if ($input->isInteractive()) { $this->writeSection($output, array(sprintf('Path to the wsdl file: "%s"', $wsdl), sprintf('The directory where to create proxy classes: "%s"', $dir), sprintf('The namespace of proxy classes to create: "%s"', $namespace))); if (!$dialog->askConfirmation($output, $this->getQuestion('Do you confirm generation', 'yes', '?'), true)) { $output->writeln('<error>Command aborted</error>'); return 1; } } $generator = new SimpleTypeAbstractGenerator($wsdl, $dir . 'SimpleType', $namespace . '\\SimpleType', array(), $licensePath); $generator->execute(); $generator = new ComplexTypeAbstractGenerator($wsdl, $dir . 'ComplexType', $namespace . '\\ComplexType', array($namespace . '\\SimpleType'), $licensePath); $generator->execute(); $generator = new SimpleTypeGenerator($wsdl, $dir . 'SimpleType', $namespace . '\\SimpleType', array(), $licensePath); $generator->execute(); $generator = new ComplexTypeGenerator($wsdl, $dir . 'ComplexType', $namespace . '\\ComplexType', array($namespace . '\\SimpleType'), $licensePath); $generator->execute(); $generator = new SoapClientGenerator($wsdl, $dir, $namespace, array('RuntimeException', 'SoapFault', 'SoapClient as BaseSoapClient'), $licensePath); $generator->execute(); $generator = new SoapServiceGenerator($wsdl, $dir, $namespace, array('RuntimeException', 'SoapFault', 'SoapClient as BaseSoapClient', 'InvalidArgumentException'), $licensePath); $generator->execute(); unset($generator); }
/** * @depends testSimpleTypeAbstractGenerator */ public function testSimpleTypeGenerator() { $generator = new SimpleTypeGenerator(self::$wsdlPath, self::$exportPath . '/SimpleType', self::$namespace . '\\SimpleType', array(), self::$licensePath); $generator->execute(); $reflection = new \ReflectionClass(self::$namespace . '\\SimpleType\\TestChangeType'); $this->assertClass($reflection, self::$namespace . '\\SimpleType\\SimpleTypeAbstract'); $constants = array('APARTMENT_NUMBER_NOT_FOUND' => 'APARTMENT_NUMBER_NOT_FOUND', 'APARTMENT_NUMBER_REQUIRED' => 'APARTMENT_NUMBER_REQUIRED', 'NORMALIZED' => 'NORMALIZED'); $this->assertConstants($reflection, $constants); $reflection = new \ReflectionClass(self::$namespace . '\\SimpleType\\TestStatusType'); $this->assertClass($reflection, self::$namespace . '\\SimpleType\\SimpleTypeAbstract'); $constants = array('UNDETERMINED' => 'UNDETERMINED', 'BUSINESS' => 'BUSINESS', 'RESIDENTIAL' => 'RESIDENTIAL', 'INSUFFICIENT_DATA' => 'INSUFFICIENT_data', 'UNAVAILABLE' => 'UNAVAILABLE'); $this->assertConstants($reflection, $constants); }