Skip to content
Permalink
Browse files

Updating Component test case to run on PHPUnit.

  • Loading branch information...
markstory committed Jun 9, 2010
1 parent c5e4ab2 commit ac68f5c5db617905ab3ad808a1fb536f05f5df11
Showing with 9 additions and 3 deletions.
  1. +9 −3 cake/tests/cases/libs/controller/component.test.php
@@ -288,7 +288,6 @@ class SomethingWithEmailComponent extends Object {
public $components = array('Email');
}
Mock::generate('Object', 'ComponentMockComponent', array('startup', 'beforeFilter', 'beforeRender', 'other'));
/**
* ComponentTest class
@@ -422,15 +421,22 @@ function testComponentStartup() {
* @return void
*/
function testTriggerCallback() {
$mock = $this->getMock(
'Object',
array('startup', 'beforeFilter', 'beforeRender', 'other'),
array(),
'ComponentMockComponent'
);
$Controller =& new ComponentTestController();
$Controller->components = array('ComponentMock');
$Controller->uses = null;
$Controller->constructClasses();
$Controller->ComponentMock->expectOnce('beforeRender');
$Controller->ComponentMock->expects($this->once())->method('beforeRender');
$Controller->ComponentMock->expects($this->never())->method('beforeFilter');
$Controller->Component->triggerCallback('beforeRender', $Controller);
$Controller->ComponentMock->expectNever('beforeFilter');
$Controller->ComponentMock->enabled = false;
$Controller->Component->triggerCallback('beforeFilter', $Controller);
}

0 comments on commit ac68f5c

Please sign in to comment.
You can’t perform that action at this time.