/** * @SuppressWarnings(PHPMD.UnusedFormalParameter) * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var KernelInterface $kernel */ $kernel = $this->getContainer()->get('kernel'); $bundle = $kernel->getBundle($input->getArgument('bundle')); $document = $this->documentRepository->get($input->getArgument('file')); $this->generator->setSkeletonDirs(__DIR__ . '/../Resources/skeleton'); $this->generator->generate($bundle, $document, $input->getOption('namespace')); }
protected function setUp() { $bundle = new PetStoreBundle(); $document = SwaggerDocumentTest::getPetStoreDocument(); $generator = new ResourceGenerator(); $generator->setSkeletonDirs('src/Dev/Resources/skeleton'); $generator->generate($bundle, $document, 'Model\\Jms'); require_once $bundle->getPath() . '/Model/Jms/Pet.php'; require_once $bundle->getPath() . '/Model/Jms/Tag.php'; require_once $bundle->getPath() . '/Model/Jms/Category.php'; }
/** * @test */ public function canRenderResourcesFromPetStore() { $bundle = new PetStoreBundle(); $document = SwaggerDocumentTest::getPetStoreDocument(); $generator = new ResourceGenerator(); $generator->setSkeletonDirs('src/Dev/Resources/skeleton'); $generator->generate($bundle, $document, 'Foo\\Bar'); $files = ['User.php', 'Category.php', 'Pet.php', 'Order.php']; foreach ($files as $file) { $filePathName = $bundle->getPath() . '/Foo/Bar/' . $file; $this->assertTrue(file_exists($filePathName), sprintf('%s has not been generated', $filePathName)); $content = file_get_contents($filePathName); $this->assertContains("namespace {$bundle->getNamespace()}\\Foo\\Bar;", $content); } }