Skip to content

Commit

Permalink
Fixing JsHelper test cases to use the request object.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 15, 2010
1 parent 322cceb commit 4453c91
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cake/tests/cases/libs/view/helpers/js.test.php
Expand Up @@ -83,10 +83,15 @@ function startTest() {
$this->_asset = Configure::read('Asset.timestamp');
Configure::write('Asset.timestamp', false);

$request = new CakeRequest(null, false);

$this->Js = new JsHelper('JsBase');
$this->Js->request = $request;
$this->Js->Html = new HtmlHelper();
$this->Js->Html->request = $request;
$this->Js->Form = new FormHelper();
$this->Js->Form->Html = new HtmlHelper();
$this->Js->Form->request = $request;
$this->Js->Form->Html = $this->Js->Html;
$this->Js->JsBaseEngine = new JsBaseEngineHelper();

$view = new JsHelperMockView();
Expand All @@ -111,10 +116,15 @@ function endTest() {
* @return void
*/
function _useMock() {
$request = new CakeRequest(null, false);

$this->Js = new JsHelper(array('TestJs'));
$this->Js->request = $request;
$this->Js->TestJsEngine = new TestJsEngineHelper($this);
$this->Js->Html = new HtmlHelper();
$this->Js->Html->request = $request;
$this->Js->Form = new FormHelper();
$this->Js->Form->request = $request;
$this->Js->Form->Html = new HtmlHelper();
}

Expand Down Expand Up @@ -278,6 +288,7 @@ function testWriteScriptsInFile() {
if ($this->skipIf(!is_writable(JS), 'webroot/js is not Writable, script caching test has been skipped')) {
return;
}
$this->Js->request->webroot = '/';
$this->Js->JsBaseEngine = new TestJsEngineHelper();
$this->Js->buffer('one = 1;');
$this->Js->buffer('two = 2;');
Expand Down

0 comments on commit 4453c91

Please sign in to comment.