mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Starting to modify Helper constructors.
This commit is contained in:
parent
1d983e1cd4
commit
087ccabffe
5 changed files with 11 additions and 45 deletions
|
@ -145,8 +145,10 @@ class Helper extends Object {
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*
|
*
|
||||||
|
* @param View $View The View this helper is being attached to.
|
||||||
|
* @param array $settings Configuration settings for the helper.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct(View $View, $settings = array()) {
|
||||||
// Nothing to see here.
|
// Nothing to see here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,10 +81,11 @@ class JsHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Constructor - determines engine helper
|
* Constructor - determines engine helper
|
||||||
*
|
*
|
||||||
|
* @param View $View the view object the helper is attached to.
|
||||||
* @param array $settings Settings array contains name of engine helper.
|
* @param array $settings Settings array contains name of engine helper.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($settings = array()) {
|
public function __construct(View $View, $settings = array()) {
|
||||||
$className = 'Jquery';
|
$className = 'Jquery';
|
||||||
if (is_array($settings) && isset($settings[0])) {
|
if (is_array($settings) && isset($settings[0])) {
|
||||||
$className = $settings[0];
|
$className = $settings[0];
|
||||||
|
|
|
@ -85,10 +85,12 @@ class PaginatorHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* The chosen custom helper must implement a `link()` method.
|
* The chosen custom helper must implement a `link()` method.
|
||||||
*
|
*
|
||||||
|
* @param View $View the view object the helper is attached to.
|
||||||
|
* @param array $settings Array of settings.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct($config = array()) {
|
function __construct(View $View, $settings = array()) {
|
||||||
$ajaxProvider = isset($config['ajax']) ? $config['ajax'] : 'Js';
|
$ajaxProvider = isset($settings['ajax']) ? $settings['ajax'] : 'Js';
|
||||||
$this->helpers[] = $ajaxProvider;
|
$this->helpers[] = $ajaxProvider;
|
||||||
$this->_ajaxHelperClass = $ajaxProvider;
|
$this->_ajaxHelperClass = $ajaxProvider;
|
||||||
if (!class_exists($ajaxProvider . 'Helper')) {
|
if (!class_exists($ajaxProvider . 'Helper')) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class XmlHelper extends AppHelper {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
function __construct(View $View, $settings = array()) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->Xml =& new Xml();
|
$this->Xml =& new Xml();
|
||||||
$this->Xml->options(array('verifyNs' => false));
|
$this->Xml->options(array('verifyNs' => false));
|
||||||
|
|
|
@ -706,7 +706,7 @@ class ViewTest extends CakeTestCase {
|
||||||
$View->helpers = array('Cache', 'Html', 'Session');
|
$View->helpers = array('Cache', 'Html', 'Session');
|
||||||
$View->loadHelpers();
|
$View->loadHelpers();
|
||||||
|
|
||||||
$View->Helpers->Cache = $this->getMock('CacheHelper');
|
$View->Helpers->Cache = $this->getMock('CacheHelper', array(), array($View));
|
||||||
$View->Helpers->Cache->expects($this->exactly(2))->method('cache');
|
$View->Helpers->Cache->expects($this->exactly(2))->method('cache');
|
||||||
|
|
||||||
$result = $View->render('index');
|
$result = $View->render('index');
|
||||||
|
@ -797,45 +797,6 @@ class ViewTest extends CakeTestCase {
|
||||||
@unlink($path);
|
@unlink($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testRenderNocache method
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This is a new test case for a pending enhancement
|
|
||||||
function testRenderNocache() {
|
|
||||||
$this->PostsController->helpers = array('Cache', 'Html');
|
|
||||||
$this->PostsController->constructClasses();
|
|
||||||
$this->PostsController->cacheAction = 21600;
|
|
||||||
$this->PostsController->here = '/posts/nocache_multiple_element';
|
|
||||||
$this->PostsController->action = 'nocache_multiple_element';
|
|
||||||
$this->PostsController->nocache_multiple_element();
|
|
||||||
Configure::write('Cache.check', true);
|
|
||||||
Configure::write('Cache.disable', false);
|
|
||||||
|
|
||||||
$filename = CACHE . 'views' . DS . 'posts_nocache_multiple_element.php';
|
|
||||||
|
|
||||||
$View = new TestView($this->PostsController);
|
|
||||||
$View->render();
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
$View->renderCache($filename, getMicroTime());
|
|
||||||
$result = ob_get_clean();
|
|
||||||
@unlink($filename);
|
|
||||||
|
|
||||||
$this->assertPattern('/php echo \$foo;/', $result);
|
|
||||||
$this->assertPattern('/php echo \$bar;/', $result);
|
|
||||||
$this->assertPattern('/php \$barfoo = \'in sub2\';/', $result);
|
|
||||||
$this->assertPattern('/php echo \$barfoo;/', $result);
|
|
||||||
$this->assertPattern('/printing: "in sub2"/', $result);
|
|
||||||
$this->assertPattern('/php \$foobar = \'in sub1\';/', $result);
|
|
||||||
$this->assertPattern('/php echo \$foobar;/', $result);
|
|
||||||
$this->assertPattern('/printing: "in sub1"/', $result);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSet method
|
* testSet method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue