diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 5a319a827..4b6e2bc60 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -94,8 +94,10 @@ class PaginatorHelper extends AppHelper { App::import('Helper', $ajaxProvider); $classname = $ajaxProvider . 'Helper'; - if (!is_callable(array($classname, 'link'))) { - trigger_error(sprintf(__('%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname), E_USER_WARNING); + if (!method_exists($classname, 'link')) { + throw new Exception(sprintf( + __('%s does not implement a link() method, it is incompatible with PaginatorHelper'), $classname + )); } } diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 65c716b2c..d2753f577 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -17,7 +17,7 @@ * @since CakePHP(tm) v 1.2.0.4206 * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript', 'Js')); +App::import('Helper', array('Html', 'Paginator', 'Form', 'Js')); Mock::generate('JsHelper', 'PaginatorMockJsHelper'); @@ -36,7 +36,7 @@ class PaginatorHelperTest extends CakeTestCase { * @return void */ function setUp() { - $this->Paginator = new PaginatorHelper(array('ajax' => 'Ajax')); + $this->Paginator = new PaginatorHelper(); $this->Paginator->params['paging'] = array( 'Article' => array( 'current' => 9, @@ -57,11 +57,8 @@ class PaginatorHelperTest extends CakeTestCase { ) ) ); - $this->Paginator->Html =& new HtmlHelper(); - $this->Paginator->Ajax =& new AjaxHelper(); - $this->Paginator->Ajax->Html =& new HtmlHelper(); - $this->Paginator->Ajax->Javascript =& new JavascriptHelper(); - $this->Paginator->Ajax->Form =& new FormHelper(); + $this->Paginator->Html = new HtmlHelper(); + $this->Paginator->Js = new PaginatorMockJsHelper(); Configure::write('Routing.prefixes', array()); Router::reload(); @@ -134,7 +131,7 @@ class PaginatorHelperTest extends CakeTestCase { Router::reload(); Router::parse('/'); Router::setRequestInfo(array( - array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'form' => array(), 'url' => array('url' => 'accounts/', 'mod_rewrite' => 'true'), 'bare' => 0), + array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'form' => array(), 'url' => array('url' => 'accounts/'), 'bare' => 0), array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/', 'passedArgs' => array()) )); $this->Paginator->options(array('url' => array('param'))); @@ -154,10 +151,6 @@ class PaginatorHelperTest extends CakeTestCase { ); $this->assertTags($result, $expected); - $result = $this->Paginator->numbers(array('modulus'=> '2', 'url'=> array('controller'=>'projects', 'action'=>'sort'),'update'=>'list')); - $this->assertPattern('/\/projects\/sort\/page:2/', $result); - $this->assertPattern('/