Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Test case observer

Vadim Justus edited this page Jun 26, 2014 · 2 revisions

TechDivision_MagentoUnitTesting_TestCase_Observer

The test case is designed for testing observer model classes.

Mock objects

The test case initiates mock objects during the setup process. Use the method getRegisteredMock() to get access to the mock instances.

The following list shows which key you can use and what mock you will get.

Key Class
varien_observer Varien_Event_Observer
varien_event Varien_Event

Example:

$mock = $this->getRegisteredMock('some-key');

Public methods

There are additional public methods provided by that test case.

/**
 * @param string $key
 * @param mixed $value
 */
public function addEventData($key, $value) {}

/**
 * @return PHPUnit_Framework_MockObject_MockObject|Varien_Event_Observer
 */
public function getVarienObserverMock() {}

/**
 * @return PHPUnit_Framework_MockObject_MockObject|Varien_Event
 */
public function getVarienEventMock() {}