Skip to content

Commit

Permalink
Merge pull request #365 from cakephp/default-theme
Browse files Browse the repository at this point in the history
Allow setting default theme through Configure.
  • Loading branch information
markstory authored Oct 12, 2017
2 parents 8bbb42a + 88b5c65 commit a108e7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Shell/BakeShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ public function getOptionParser()
])->addOption('theme', [
'short' => 't',
'help' => 'The theme to use when baking code.',
'default' => Configure::read('Bake.theme'),
'choices' => $bakeThemes
]);

Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/Shell/BakeShellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ public function testGetOptionParser()
$this->assertArrayHasKey('template', $commands);
$this->assertArrayHasKey('controller', $commands);
$this->assertArrayHasKey('model', $commands);

$this->assertNull($parser->options()['theme']->defaultValue());

Configure::write('Bake.theme', 'Mytheme');
$parser = $this->Shell->getOptionParser();
$this->assertSame('Mytheme', $parser->options()['theme']->defaultValue());
Configure::delete('Bake.theme');
}

/**
Expand Down

0 comments on commit a108e7d

Please sign in to comment.