Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix various failing tests.

  • Loading branch information...
commit 0607437abd647d5e3145f6fbc4149d4c4b1fabff 1 parent e9779e7
@markstory markstory authored
View
2  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -251,7 +251,7 @@ public function testComplexNoCache () {
$result = $View->render('sequencial_nocache');
$this->assertNotRegExp('/cake:nocache/', $result);
- $this->assertNotRegExpy('/php echo/', $result);
+ $this->assertNotRegExp('/php echo/', $result);
$this->assertRegExp('/A\. Layout Before Content/', $result);
$this->assertRegExp('/B\. In Plain Element/', $result);
$this->assertRegExp('/C\. Layout After Test Element/', $result);
View
12 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
@@ -102,7 +102,7 @@ public function setUp() {
Configure::write('Asset.timestamp', false);
$controller = null;
- $this->View = $this->getMock('View', array('addScript'), array(&$controller));
+ $this->View = $this->getMock('View', array('append'), array(&$controller));
$this->Js = new JsHelper($this->View, 'Option');
$request = new CakeRequest(null, false);
$this->Js->request = $request;
@@ -274,8 +274,8 @@ public function testWriteScriptsNoFile() {
$result = $this->Js->writeBuffer(array('onDomReady' => true, 'cache' => false, 'clear' => false));
$this->View->expects($this->once())
- ->method('addScript')
- ->with($this->matchesRegularExpression('/one\s\=\s1;\ntwo\s\=\s2;/'));
+ ->method('append')
+ ->with('script', $this->matchesRegularExpression('/one\s\=\s1;\ntwo\s\=\s2;/'));
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'cache' => false));
}
@@ -288,8 +288,8 @@ public function testWriteBufferNotInline() {
$this->Js->set('foo', 1);
$this->View->expects($this->once())
- ->method('addScript')
- ->with($this->matchesRegularExpression('#<script type="text\/javascript">window.app \= \{"foo"\:1\}\;<\/script>#'));
+ ->method('append')
+ ->with('script', $this->matchesRegularExpression('#<script type="text\/javascript">window.app \= \{"foo"\:1\}\;<\/script>#'));
$result = $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
}
@@ -705,7 +705,7 @@ class JsBaseEngineTest extends CakeTestCase {
public function setUp() {
parent::setUp();
$controller = null;
- $this->View = $this->getMock('View', array('addScript'), array(&$controller));
+ $this->View = $this->getMock('View', array('append'), array(&$controller));
$this->JsEngine = new OptionEngineHelper($this->View);
}
View
4 lib/Cake/TestSuite/ControllerTestCase.php
@@ -95,7 +95,7 @@ class InterceptContentHelper extends Helper {
* @param string $viewFile The view file
*/
public function afterRender($viewFile) {
- $this->_View->_viewNoLayout = $this->_View->output;
+ $this->_View->assign('__view_no_layout__', $this->_View->fetch('content'));
$this->_View->Helpers->unload('InterceptContent');
}
}
@@ -266,7 +266,7 @@ protected function _testAction($url = '', $options = array()) {
$this->vars = $this->controller->viewVars;
$this->contents = $this->controller->response->body();
if (isset($this->controller->View)) {
- $this->view = $this->controller->View->_viewNoLayout;
+ $this->view = $this->controller->View->fetch('__view_no_layout__');
}
$this->__dirtyController = true;
$this->headers = $Dispatch->response->header();
View
8 lib/Cake/View/JsonView.php
@@ -91,10 +91,14 @@ public function render($view = null, $layout = null) {
} else {
$data = isset($this->viewVars[$serialize]) ? $this->viewVars[$serialize] : null;
}
- return $this->output = json_encode($data);
+ $content = json_encode($data);
+ $this->Blocks->set('content', $content);
+ return $content;
}
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
- return $this->output = $this->_render($viewFileName);
+ $content = $this->_render($viewFileName);
+ $this->Blocks->set('content', $content);
+ return $content;
}
}
View
5 lib/Cake/View/View.php
@@ -773,11 +773,14 @@ protected function _render($viewFile, $data = array()) {
if ($this->Blocks->active()) {
throw new CakeException(__d('cake_dev', 'The "%s" block was left open.', $this->Blocks->active()));
}
- $content = $this->Helpers->trigger(
+ $result = $this->Helpers->trigger(
'afterRenderFile',
array($viewFile, $content),
array('modParams' => 1)
);
+ if ($result !== true) {
+ $content = $result;
+ }
if (isset($this->_parents[$viewFile])) {
$this->_stack[] = $this->fetch('content');
View
8 lib/Cake/View/XmlView.php
@@ -94,10 +94,14 @@ public function render($view = null, $layout = null) {
} else {
$data = isset($this->viewVars[$serialize]) ? $this->viewVars[$serialize] : null;
}
- return $this->output = Xml::fromArray($data)->asXML();
+ $content = Xml::fromArray($data)->asXML();
+ $this->Blocks->set('content', $content);
+ return $content;
}
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
- return $this->output = $this->_render($viewFileName);
+ $content = $this->_render($viewFileName);
+ $this->Blocks->set('content', (string)$content);
+ return $content;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.