mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing View test case to be compatible with PHPUnit
This commit is contained in:
parent
b8e83e6a49
commit
d252fdeb52
1 changed files with 7 additions and 9 deletions
|
@ -20,9 +20,6 @@
|
|||
App::import('Core', array('View', 'Controller'));
|
||||
App::import('Helper', 'Cache');
|
||||
|
||||
Mock::generate('Helper', 'CallbackMockHelper');
|
||||
Mock::generate('CacheHelper', 'ViewTestMockCacheHelper');
|
||||
|
||||
if (!class_exists('ErrorHandler')) {
|
||||
App::import('Core', array('Error'));
|
||||
}
|
||||
|
@ -608,14 +605,15 @@ class ViewTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testHelperCallbackTriggering() {
|
||||
$mockHelper = $this->getMock('Helper', array(), array(), 'CallbackMockHelper');
|
||||
$this->PostsController->helpers = array('Session', 'Html', 'CallbackMock');
|
||||
$View = new TestView($this->PostsController);
|
||||
$loaded = array();
|
||||
$View->loaded = $View->loadHelpers($loaded, $this->PostsController->helpers);
|
||||
$View->loaded['CallbackMock']->expectOnce('beforeRender');
|
||||
$View->loaded['CallbackMock']->expectOnce('afterRender');
|
||||
$View->loaded['CallbackMock']->expectOnce('beforeLayout');
|
||||
$View->loaded['CallbackMock']->expectOnce('afterLayout');
|
||||
$View->loaded['CallbackMock']->expects($this->once())->method('beforeRender');
|
||||
$View->loaded['CallbackMock']->expects($this->once())->method('afterRender');
|
||||
$View->loaded['CallbackMock']->expects($this->once())->method('beforeLayout');
|
||||
$View->loaded['CallbackMock']->expects($this->once())->method('afterLayout');
|
||||
$View->render('index');
|
||||
}
|
||||
|
||||
|
@ -745,8 +743,8 @@ class ViewTest extends CakeTestCase {
|
|||
$Controller = new ViewPostsController();
|
||||
$Controller->cacheAction = '1 day';
|
||||
$View = new View($Controller);
|
||||
$View->loaded['cache'] = new ViewTestMockCacheHelper();
|
||||
$View->loaded['cache']->expectCallCount('cache', 2);
|
||||
$View->loaded['cache'] = $this->getMock('CacheHelper');
|
||||
$View->loaded['cache']->expects($this->exactly(2))->method('cache');
|
||||
|
||||
$result = $View->render('index');
|
||||
$this->assertPattern('/posts index/', $result);
|
||||
|
|
Loading…
Reference in a new issue