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

Test case front controller

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

TechDivision_MagentoUnitTesting_TestCase_FrontController

The test case is designed for testing controller 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 you which key you can use and what mock you will get.

Key Class
response Mage_Core_Controller_Response_Http
front_controller Mage_Core_Controller_Varien_Front
layout Mage_Core_Model_Layout
layout_update Mage_Core_Model_Layout_Update
design_package Mage_Core_Model_Design_Package
translate_inline Mage_Core_Model_Translate_Inline

Example:

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

Public methods

There are additional public methods provided by the test case.

/**
 * Add mocked block instance to layout
 *
 * @param string $nameInLayout
 * @param string $blockClassName
 */
public function addMockedBlockToLayout($nameInLayout, $blockClassName) {}