Skip to content
Permalink
Browse files

Make schema import plugin friendly.

The changes in #8694 pointed out that schema importing doesn't play nice
with plugins. This corrects that.
  • Loading branch information...
markstory committed Apr 23, 2016
1 parent 3a75e8a commit 9536a10d6d048a8024f5bb32548cade2c48ca956
@@ -178,9 +178,13 @@ protected function _interactive() {
*/
public function importOptions($modelName) {
$options = array();
$plugin = '';
if (isset($this->params['plugin'])) {
$plugin = $this->params['plugin'] . '.';
}
if (!empty($this->params['schema'])) {
$options['schema'] = $modelName;
$options['schema'] = $plugin . $modelName;
} elseif ($this->interactive) {
$doSchema = $this->in(__d('cake_console', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
if ($doSchema === 'y') {
@@ -136,6 +136,19 @@ public function testImportOptionsWithCommandLineOptions() {
$this->assertEquals($expected, $result);
}
/**
* test importOptions with overwriting CLI options
*
* @return void
*/
public function testImportOptionsWithCommandLineOptionsPlugin() {
$this->Task->params = array('schema' => true, 'records' => true, 'plugin' => 'TestPlugin');
$result = $this->Task->importOptions('Article');
$expected = array('schema' => 'TestPlugin.Article', 'fromTable' => true);
$this->assertEquals($expected, $result);
}
/**
* test importOptions with schema.
*

0 comments on commit 9536a10

Please sign in to comment.
You can’t perform that action at this time.