Example #1
0
 /**
  * Get data and pass to command handler.
  *
  * @return mixed
  */
 public function handle()
 {
     $name = $this->argument('name');
     $root_namespace = $this->getAppNamespace();
     $file_namespace = $root_namespace . 'Petrol\\Fillers\\Fill' . $this->makeClassName($name);
     $errors = $this->option('errors');
     $config_path = getcwd() . '/config/database.php';
     $source = 'artisan';
     $data = new FillData($file_namespace, $errors, $config_path, $source);
     $handler = new FillHandler(new ArgvInput(), new ConsoleOutput());
     $handler->handle($data);
 }
Example #2
0
 /**
  * Get data and pass to command handler.
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $name = $input->getArgument('name');
     $file_namespace = 'Petrol\\Fillers\\Fill' . $this->makeClassName($name);
     $errors = $input->getOption('errors');
     $config_path = 'config.php';
     if ($input->getOption('quiet')) {
         $source = 'test';
     } else {
         $source = 'console';
     }
     $data = new FillData($file_namespace, $errors, $config_path, $source);
     $handler = new FillHandler($input, $output);
     $handler->handle($data);
 }
Example #3
0
 /**
  * Parse XML and store as individual columns.
  *
  * @test
  */
 public function parse_xml_and_fill_columns_table()
 {
     $data = new FillData('Petrol\\Tests\\files\\BooksColumns', false, 'config.php', '.env', 'test');
     $handler = new FillHandler(new ArgvInput(), new ConsoleOutput());
     $handler->handle($data);
     $actual = $this->getConnection()->createQueryTable('books_columns', 'SELECT * FROM books_columns');
     $expected = $this->getDataSet('books.xml')->getTable('books_columns');
     $this->assertTablesEqual($expected, $actual);
 }
 /**
  * Incorrectly set variables property in filler.
  *
  * @test
  * @expectedException Exception
  * @expectedExceptionMessage $variables property must be array.
  */
 public function wrong_variables_property_throws_exception()
 {
     $data = new FillData('Petrol\\Tests\\files\\FillerWrongVariables', false, 'config.php', '.env', 'test');
     $fill = new FillHandler(new ArgvInput(), new ConsoleOutput());
     $fill->handle($data);
 }