mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Updating Component test case to run on PHPUnit.
This commit is contained in:
parent
c5e4ab2366
commit
ac68f5c5db
1 changed files with 9 additions and 3 deletions
|
@ -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 @@ class ComponentTest extends CakeTestCase {
|
|||
* @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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue