/** * @expectedException \InvalidArgumentException */ public static function testParseException() { GeneratorOptions::instance(__DIR__ . '/../resources/bad_generator_options.yml'); }
/** * @return string[] */ public function getGeneratorOptionsPossibilities() { return array($this->getGeneratorOptionsConfigOption(), sprintf('%s/%s', getcwd(), self::PROPER_USER_CONFIGURATION), sprintf('%s/%s', getcwd(), self::DEFAULT_CONFIGURATION_FILE), GeneratorOptions::getDefaultConfigurationPath()); }
/** * @expectedException \InvalidArgumentException */ public function testExceptionOnWsdl() { $options = GeneratorOptions::instance(); $options->setComposerName('wsdltophp/invalid')->setDestination(self::getTestDirectory())->setOrigin(self::schemaPartnerPath()); new Generator($options); }
/** * Sets the optionServicesFolder value * @param string $optionServicesFolder * @return Generator */ public function setOptionServicesFolder($optionServicesFolder) { $this->options->setServicesFolder($optionServicesFolder); return $this; }
/** * */ public function testResolveGeneratorOptionsConfigPathUsingDefaultConfig() { $command = new GeneratePackageCommand('WsdlToPhp'); $input = new ArrayInput(array('--urlorpath' => self::wsdlBingPath(), '--destination' => self::getTestDirectory() . '/debug/', '--composer-name' => 'wsdltophp/package', '--gentutorial' => 'true', '--genericconstants' => 'false')); chdir(self::getTestDirectory()); $output = new ConsoleOutput(OutputInterface::VERBOSITY_QUIET); $command->run($input, $output); $this->assertSame(GeneratorOptions::getDefaultConfigurationPath(), $command->resolveGeneratorOptionsConfigPath()); }
/** * @param string $dir * @param string $wsdl */ private function generate($dir, $wsdl, $standalone = true) { Utils::createDirectory($destination = self::getTestDirectory() . $dir); $options = GeneratorOptions::instance(); $options->setGenerateTutorialFile(false)->setAddComments(array())->setArraysFolder('ArrayType')->setBasicLogin('')->setBasicPassword('')->setCategory(GeneratorOptions::VALUE_CAT)->setComposerName($standalone ? 'wsdltophp/' . $dir : '')->setDestination($destination)->setEnumsFolder('EnumType')->setGatherMethods(GeneratorOptions::VALUE_START)->setGenerateTutorialFile(true)->setGenericConstantsName(false)->setNamespace('')->setOrigin($wsdl)->setPrefix('')->setProxyHost('')->setProxyLogin('')->setProxyPassword('')->setProxyPort('')->setServicesFolder('ServiceType')->setSoapClientClass('\\WsdlToPhp\\PackageBase\\AbstractSoapClientBase')->setSoapOptions(array())->setStandalone($standalone)->setStructArrayClass('\\WsdlToPhp\\PackageBase\\AbstractStructArrayBase')->setStructClass('\\WsdlToPhp\\PackageBase\\AbstractStructBase')->setStructsFolder('StructType')->setSuffix(''); $generator = new Generator($options); $generator->generatePackage(); $this->assertTrue(is_dir($destination)); if ($standalone) { $this->assertTrue(is_file(sprintf('%s/composer.json', $destination))); $this->assertTrue(is_file(sprintf('%s/composer.lock', $destination))); } $this->assertTrue(is_file(sprintf('%s/tutorial.php', $destination))); $this->assertTrue(is_file($generator->getFiles()->getClassmapFile()->getFileName())); }