/**
  * Save the schema into lock file.
  *
  * @param array $options Set connection name and path to save the schema.lock file.
  * @return void
  */
 public function save($options = [])
 {
     $this->_config = array_merge($this->_config, $this->params, $options);
     if ($this->_config['no-interaction']) {
         $this->interactive = false;
     }
     parent::bake('schema');
 }
Beispiel #2
0
 /**
  * Test baking within a plugin.
  *
  * @return void
  */
 public function testBakePlugin()
 {
     $this->_loadTestPlugin('TestBake');
     $path = Plugin::path('TestBake');
     $this->Task->plugin = 'TestBake';
     $this->Task->expects($this->once())->method('createFile')->with($this->_normalizePath($path . 'src/Model/Behavior/ExampleBehavior.php'), $this->stringContains('class ExampleBehavior extends Behavior'));
     $result = $this->Task->bake('Example');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
 /**
  * {@inheritDoc}
  *
  * Adds the necessary class suffix and type in the Bake\Test instance responsible
  * of baking tests class files for the maintenance mode
  */
 public function bakeTest($className)
 {
     if (!isset($this->Test->classSuffixes[$this->name()])) {
         $this->Test->classSuffixes[$this->name()] = '';
     }
     $name = ucfirst($this->name());
     if (!isset($this->Test->classTypes[$name])) {
         $this->Test->classTypes[$name] = 'Maintenance\\Mode';
     }
     return parent::bakeTest($className);
 }
 /**
  * main() method.
  *
  * @return bool|int Success or error code.
  */
 public function generate(array $options = [])
 {
     // Hook into the bake process to load our SchemaHelper
     EventManager::instance()->on('Bake.initialize', function (Event $event) {
         $view = $event->subject;
         $view->loadHelper('Schema.Schema');
     });
     $this->_config = array_merge($this->_config, $this->params, $options);
     if ($this->_config['no-interaction']) {
         $this->interactive = false;
     }
     if (!file_exists($this->_config['path'])) {
         throw new Exception(sprintf('Schema file "%s" does not exist.', $this->_config['path']));
     }
     parent::bake('seed');
 }
Beispiel #5
0
 /**
  * {@inheritDoc}
  */
 public function bake($name)
 {
     $this->params['no-test'] = true;
     return parent::bake($name);
 }
Beispiel #6
0
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->addOption('no-includes', ['help' => 'Disable generating associations', 'default' => false, 'boolean' => true]);
     return $parser;
 }
Beispiel #7
0
 /**
  * Bake the Mailer class and html/text layout files.
  *
  * @param string $name The name of the mailer to make.
  * @return string
  */
 public function bake($name)
 {
     $this->bakeLayouts($name);
     return parent::bake($name);
 }