Updating Component test case to run on PHPUnit.

This commit is contained in:
mark_story 2010-06-09 00:13:52 -04:00
parent c5e4ab2366
commit ac68f5c5db

View file

@ -288,7 +288,6 @@ class SomethingWithEmailComponent extends Object {
public $components = array('Email'); public $components = array('Email');
} }
Mock::generate('Object', 'ComponentMockComponent', array('startup', 'beforeFilter', 'beforeRender', 'other'));
/** /**
* ComponentTest class * ComponentTest class
@ -422,15 +421,22 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testTriggerCallback() { function testTriggerCallback() {
$mock = $this->getMock(
'Object',
array('startup', 'beforeFilter', 'beforeRender', 'other'),
array(),
'ComponentMockComponent'
);
$Controller =& new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('ComponentMock'); $Controller->components = array('ComponentMock');
$Controller->uses = null; $Controller->uses = null;
$Controller->constructClasses(); $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->Component->triggerCallback('beforeRender', $Controller);
$Controller->ComponentMock->expectNever('beforeFilter');
$Controller->ComponentMock->enabled = false; $Controller->ComponentMock->enabled = false;
$Controller->Component->triggerCallback('beforeFilter', $Controller); $Controller->Component->triggerCallback('beforeFilter', $Controller);
} }