Skip to content

Commit

Permalink
Updating Component test case to run on PHPUnit.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 9, 2010
1 parent c5e4ab2 commit ac68f5c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cake/tests/cases/libs/controller/component.test.php
Expand Up @@ -288,7 +288,6 @@ class SomethingWithEmailComponent extends Object {
public $components = array('Email');
}

Mock::generate('Object', 'ComponentMockComponent', array('startup', 'beforeFilter', 'beforeRender', 'other'));

/**
* ComponentTest class
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ac68f5c

Please sign in to comment.