Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = new Config();
     $config->setBasePath(getcwd());
     $config->setFromArray($input->getArguments());
     $config->setFromArray(array('bare' => $input->getOption('bare')));
     $moduleConfig = new ConfigWriter($config);
     $state = new State($moduleConfig);
     $builder = new FullContainer($config);
     $builder->prepare($state);
     $builder->build($state);
     $writeState = new State($moduleConfig);
     $models = array('service' => $state->getServiceModel(), 'factory' => $state->getModel('service-factory'), 'trait' => $state->getModel('service-trait'), 'test' => $state->getModel('service-test'));
     foreach (array_keys($models) as $key) {
         if ($input->getOption('no-' . $key)) {
             $models[$key] = false;
         }
         if ($input->getOption('only-' . $key)) {
             foreach (array_keys($models) as $index) {
                 if ($key != $index) {
                     $models[$index] = false;
                 }
             }
         }
     }
     foreach ($models as $model) {
         if ($model) {
             $writeState->addModel($model);
         }
     }
     $writer = new ModelWriter($config);
     $writer->write($writeState, $output);
     $moduleConfig->save($output);
 }
Exemplo n.º 2
0
 public function testConstruct()
 {
     $container = new FullContainer($this->getConfig());
     $builders = $container->getBuilders();
     $i = 0;
     $this->assertInstanceOf('Scaffold\\Builder\\Service\\ServiceBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Service\\ServiceFactoryBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Service\\ServiceTraitBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Service\\ServiceTestBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Entity\\EntityBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Entity\\EntityTestBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Repository\\RepositoryBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Repository\\RepositoryTraitBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Form\\FormFactoryBuilder', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Container\\ExceptionContainer', $builders[$i++]);
     $this->assertInstanceOf('Scaffold\\Builder\\Controller\\ControllerBuilder', $builders[$i++]);
 }