From 29881561d356fa22fee0dea800ad767d5b98eea4 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 9 Aug 2009 17:53:18 -0400 Subject: [PATCH] Adding tests to test arbitrary class injection. --- .../libs/view/helpers/paginator.test.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 6e2751bd998..20fb2842ea6 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -25,7 +25,9 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript')); +App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript', 'Js')); + +Mock::generate('JsHelper', 'PaginatorMockJsHelper'); /** * PaginatorHelperTest class @@ -1613,5 +1615,28 @@ function testNextLinkUsingDotNotation() { ); $this->assertTags($result, $expected); } + +/** + * test that mock classes injected into paginatorHelper are called when using link() + * + * @return void + **/ + function testMockAjaxProviderClassInjection() { + $Paginator =& new PaginatorHelper(array('ajax' => 'PaginatorMockJs')); + $Paginator->params['paging'] = array( + 'Article' => array( + 'current' => 9, + 'count' => 62, + 'prevPage' => false, + 'nextPage' => true, + 'pageCount' => 7, + 'defaults' => array(), + 'options' => array() + ) + ); + $Paginator->PaginatorMockJs =& new PaginatorMockJsHelper(); + $Paginator->PaginatorMockJs->expectOnce('link'); + $result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content')); + } } ?> \ No newline at end of file