diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 33afa5beba4..a6872faa82f 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -80,12 +80,21 @@ class PaginatorHelper extends AppHelper { * or choose a non JsHelper Helper. If you want to use a specific library with JsHelper declare JsHelper and its * adapter before including PaginatorHelper in your helpers array. * + * The chosen custom helper must implement a `link()` method. + * * @return void **/ function __construct($config = array()) { $ajaxProvider = isset($config['ajax']) ? $config['ajax'] : 'Js'; $this->helpers[] = $ajaxProvider; $this->_ajaxHelperClass = $ajaxProvider; + if (!method_exists($ajaxProvider . 'Helper', 'link')) { + $message = sprintf( + __('%s does not implement a link() method, it is incompatible with PaginatorHelper', true), + $ajaxProvider . 'Helper' + ); + trigger_error($message, E_USER_WARNING); + } } /** diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 4f958bf4456..c197f1f9507 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -1637,6 +1637,9 @@ function testMockAjaxProviderClassInjection() { $Paginator->PaginatorMockJs =& new PaginatorMockJsHelper(); $Paginator->PaginatorMockJs->expectOnce('link'); $result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content')); + + $this->expectError(); + $Paginator =& new PaginatorHelper(array('ajax' => 'Form')); } } ?> \ No newline at end of file