mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix various failing tests.
This commit is contained in:
parent
e9779e7126
commit
0607437abd
6 changed files with 25 additions and 14 deletions
|
@ -251,7 +251,7 @@ class CacheHelperTest extends CakeTestCase {
|
|||
$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);
|
||||
|
|
|
@ -102,7 +102,7 @@ class JsHelperTest extends CakeTestCase {
|
|||
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 @@ class JsHelperTest extends CakeTestCase {
|
|||
$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 @@ class JsHelperTest extends CakeTestCase {
|
|||
$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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
$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();
|
||||
|
|
|
@ -91,10 +91,14 @@ class JsonView extends View {
|
|||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -773,11 +773,14 @@ class View extends Object {
|
|||
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');
|
||||
|
|
|
@ -94,10 +94,14 @@ class XmlView extends View {
|
|||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue