* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class GenerateCommandTest extends TestCase { public function testGenerateClientPhp() { $command = $this->getGenerateCommand(); $commandTester = new CommandTester($command); $commandTester->execute(array( 'dir' => __DIR__ . '/output', '--format' => GeneratorFactoryInterface::CLIENT_PHP, '--config' => 'Acme\\Sdk\\Generated', )); $this->assertFileExists(__DIR__ . '/output/sdk-client-php.zip'); } public function testGenerateSpecOpenAPI() { $command = $this->getGenerateCommand(); $commandTester = new CommandTester($command); $commandTester->execute(array( 'dir' => __DIR__ . '/output', '--format' => GeneratorFactoryInterface::SPEC_OPENAPI, )); $this->assertFileExists(__DIR__ . '/output/output-spec-openapi.json'); } protected function getGenerateCommand() { $schemaReader = new \Doctrine\Common\Annotations\SimpleAnnotationReader(); $schemaReader->addNamespace('PSX\\Schema\\Annotation'); $apiReader = new \Doctrine\Common\Annotations\SimpleAnnotationReader(); $apiReader->addNamespace('PSX\\Api\\Annotation'); $apiManager = new ApiManager($apiReader, new SchemaManager($schemaReader)); $listing = new MemoryListing(); $listing->addRoute(new Route('/foo', ['GET'], '*')); $listing->addSpecification($apiManager->getApi(TestController::class, '/foo')); $factory = new GeneratorFactory($schemaReader, 'urn:phpsx.org:2016#', 'http://foo.com', ''); return new GenerateCommand($listing, $factory); } } __halt_compiler();----SIGNATURE:----L/g7YedrplSGqxS4AeTJ99C3DJPSw8IITR78jCWtFx0YjSRMmmRmqCICVSCakHQd+s0gWUgBEeC45nEzEnjP5ASSfeAmlw2DyUu2SzPi/qxYN97OOI7/UeAbwCC2efYN3wa6YiyhFMzol31oVCsfQwtk+kQmPhSnPw2bkZDGKK+/awMAqFq2Zz3Qgsc6ROzr8/0FYEjqRJxu8fEPjPmhDrhLLahUTPtAvhrfLeI+14J+Mbpjj+rTDpVn6PdGTv2j5EgCQheSZAtVl77lSjrcqPB9FQVAV0rQvaIQiA9O26+ZJ1LTqkStferjxrnrf2SLfXTD+OMVahyhdT2rcGbv/keYwClepIZxYLpSU6oC1r8WboNdx4cUMnK07rLI8l0pW/fQ8n3w98XjV0Wsw2UPUXtssdiTQqyEMPaYzb6REr6ceYk6ZoAWHvx/wFHTj13v6RfGj9iGlh3maICZkxwrUF1/bHjKKwqRmD5nwVUGHCHXUrS/R8klACLy3krP4eukJNJa/Bl1p8hK6S/M/YNl7Djm1fbAXaAMqMeQR08lVjThHNZzaFxXSO5Xm2gev1x6vjUlzN9qJYvB4Kap1e22CiOw6AcSJhYx8GKf05nq0t+mVzy/Cl5jATlCAAD4qUDM6S6BlzU3oc3bjxxyOu9H0EKKqi7C3VyN7IHuGRi4BEo=----ATTACHMENT:----NTM3NDMxNzk0NjAwNzgyNSA1NzcyMDA1NTkzMTU1ODk1IDg2Njk4NDY4NTg0NjEyMTM=