Skip to content

Commit 6713bb1

Browse files
committed
Making themes also CamelCased
1 parent 1930452 commit 6713bb1

File tree

20 files changed

+25
-30
lines changed

20 files changed

+25
-30
lines changed

lib/Cake/Core/App.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ public static function pluginPath($plugin) {
387387
*
388388
* `App::themePath('MyTheme'); will return the full path to the 'MyTheme' theme`
389389
*
390-
* @param string $theme lower_cased theme name to find the path of.
390+
* @param string $theme theme name to find the path of.
391391
* @return string full path to the theme.
392392
*/
393393
public static function themePath($theme) {
394-
$themeDir = 'themed' . DS . Inflector::underscore($theme);
394+
$themeDir = 'Themed' . DS . Inflector::camelize($theme);
395395
foreach (self::$__packages['View'] as $path) {
396396
if (is_dir($path . $themeDir)) {
397397
return $path . $themeDir . DS ;

lib/Cake/Test/Case/Core/AppTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ function testThemePath() {
393393
'View' => array(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS)
394394
));
395395
$path = App::themePath('test_theme');
396-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS;
396+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
397397
$this->assertEqual($path, $expected);
398398

399399
$path = App::themePath('TestTheme');
400-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS;
400+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
401401
$this->assertEqual($path, $expected);
402402

403403
App::build();

lib/Cake/Test/Case/Routing/DispatcherTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,21 +1227,21 @@ public function testAssets() {
12271227
$Dispatcher->dispatch(new CakeRequest('theme/test_theme/flash/theme_test.swf'));
12281228
$result = ob_get_clean();
12291229

1230-
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'flash' . DS . 'theme_test.swf');
1230+
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'flash' . DS . 'theme_test.swf');
12311231
$this->assertEqual($file, $result);
12321232
$this->assertEqual('this is just a test to load swf file from the theme.', $result);
12331233

12341234
ob_start();
12351235
$Dispatcher->dispatch(new CakeRequest('theme/test_theme/pdfs/theme_test.pdf'));
12361236
$result = ob_get_clean();
1237-
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'pdfs' . DS . 'theme_test.pdf');
1237+
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'pdfs' . DS . 'theme_test.pdf');
12381238
$this->assertEqual($file, $result);
12391239
$this->assertEqual('this is just a test to load pdf file from the theme.', $result);
12401240

12411241
ob_start();
12421242
$Dispatcher->dispatch(new CakeRequest('theme/test_theme/img/test.jpg'));
12431243
$result = ob_get_clean();
1244-
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg');
1244+
$file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg');
12451245
$this->assertEqual($file, $result);
12461246

12471247
ob_start();

lib/Cake/Test/Case/View/ThemeViewTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,18 @@ function testPluginThemedGetTemplate() {
149149
$this->Controller->name = 'TestPlugin';
150150
$this->Controller->viewPath = 'Tests';
151151
$this->Controller->action = 'index';
152-
$this->Controller->theme = 'test_theme';
152+
$this->Controller->theme = 'TestTheme';
153153

154154
$ThemeView = new TestThemeView($this->Controller);
155-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
155+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
156156
$result = $ThemeView->getViewFileName('index');
157157
$this->assertEqual($result, $expected);
158158

159-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
159+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
160160
$result = $ThemeView->getLayoutFileName('plugin_default');
161161
$this->assertEqual($result, $expected);
162162

163-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Layouts' . DS .'default.ctp';
163+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
164164
$result = $ThemeView->getLayoutFileName('default');
165165
$this->assertEqual($result, $expected);
166166
}
@@ -179,16 +179,16 @@ function testGetTemplate() {
179179
$this->Controller->params['pass'] = array('home');
180180

181181
$ThemeView = new TestThemeView($this->Controller);
182-
$ThemeView->theme = 'test_theme';
182+
$ThemeView->theme = 'TestTheme';
183183
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
184184
$result = $ThemeView->getViewFileName('home');
185185
$this->assertEqual($result, $expected);
186186

187-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Posts' . DS .'index.ctp';
187+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS .'index.ctp';
188188
$result = $ThemeView->getViewFileName('/Posts/index');
189189
$this->assertEqual($result, $expected);
190190

191-
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Layouts' . DS .'default.ctp';
191+
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
192192
$result = $ThemeView->getLayoutFileName();
193193
$this->assertEqual($result, $expected);
194194

@@ -259,7 +259,7 @@ function testMemoryLeakInPaths() {
259259
$this->Controller->name = 'Posts';
260260
$this->Controller->viewPath = 'posts';
261261
$this->Controller->layout = 'whatever';
262-
$this->Controller->theme = 'test_theme';
262+
$this->Controller->theme = 'TestTheme';
263263

264264
$View = new ThemeView($this->Controller);
265265
$View->element('test_element');

lib/Cake/Test/Case/View/ViewTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,14 +753,14 @@ function testViewFileName() {
753753
$result = $View->getViewFileName('index');
754754
$this->assertPattern('/posts(\/|\\\)index.ctp/', $result);
755755

756-
$result = $View->getViewFileName('/pages/home');
757-
$this->assertPattern('/pages(\/|\\\)home.ctp/', $result);
756+
$result = $View->getViewFileName('/Pages/home');
757+
$this->assertPattern('/Pages(\/|\\\)home.ctp/', $result);
758758

759-
$result = $View->getViewFileName('../elements/test_element');
760-
$this->assertPattern('/elements(\/|\\\)test_element.ctp/', $result);
759+
$result = $View->getViewFileName('../Elements/test_element');
760+
$this->assertPattern('/Elements(\/|\\\)test_element.ctp/', $result);
761761

762-
$result = $View->getViewFileName('../themed/test_theme/posts/index');
763-
$this->assertPattern('/themed(\/|\\\)test_theme(\/|\\\)posts(\/|\\\)index.ctp/', $result);
762+
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
763+
$this->assertPattern('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);
764764

765765
$expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Posts' . DS .'index.ctp';
766766
$result = $View->getViewFileName('../Posts/index');

0 commit comments

Comments
 (0)