Browse Source

Merge remote-tracking branch 'origin/2.0' into 2.0-class-loading

Jose Lorenzo Rodriguez 15 years ago
parent
commit
7b7dabce48
2 changed files with 15 additions and 1 deletions
  1. 1 1
      lib/Cake/View/View.php
  2. 14 0
      lib/Cake/tests/cases/libs/view/view.test.php

+ 1 - 1
lib/Cake/View/View.php

@@ -680,7 +680,7 @@ class View extends Object {
 		}
 
 		if ($name === null) {
-			$name = $this->action;
+			$name = $this->view;
 		}
 		$name = str_replace('/', DS, $name);
 

+ 14 - 0
lib/Cake/tests/cases/libs/view/view.test.php

@@ -706,6 +706,20 @@ class ViewTest extends CakeTestCase {
 	}
 
 /**
+ * test that View::$view works
+ *
+ * @return void
+ */
+	function testRenderUsingViewProperty() {
+		$this->PostsController->view = 'cache_form';
+		$View = new TestView($this->PostsController);
+		
+		$this->assertEquals('cache_form', $View->view);
+		$result = $View->render();
+		$this->assertRegExp('/Add User/', $result);
+	}
+
+/**
  * test that view vars can replace the local helper variables
  * and not overwrite the $this->Helper references
  *