Skip to content

Commit

Permalink
Add getter for view instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Feb 14, 2017
1 parent 423489e commit 7e73073
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/View/Helper.php
Expand Up @@ -155,6 +155,16 @@ public function __get($name)
}
}

/**
* Get the view instance this helper is bound to.
*
* @return \Cake\View\View The bound view instance.
*/
public function getView()
{
return $this->_View;
}

/**
* Returns a string to be used as onclick handler for confirm dialogs.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/TestCase/View/HelperTest.php
Expand Up @@ -150,6 +150,17 @@ public function testLazyLoadingUsesReferences()
$this->assertEquals($resultA->testprop, $resultB->testprop);
}

/**
* test getting view instance
*
* @return void
*/
public function testGetView()
{
$Helper = new TestHelper($this->View);
$this->assertSame($this->View, $Helper->getView());
}

/**
* Tests __debugInfo
*
Expand Down

0 comments on commit 7e73073

Please sign in to comment.