Zend Form: How to pass parameters into the constructor?
Posted
by Andrew
on Stack Overflow
See other posts from Stack Overflow
or by Andrew
Published on 2010-06-17T17:12:33Z
Indexed on
2010/06/17
17:33 UTC
Read the original article
Hit count: 448
I'm trying to test my form. It will be constructing other objects, so I need a way to mock them. I tried passing them into the constructor...
class Form_Event extends Zend_Form
{
public function __construct($options = null, $regionMapper = null)
{
$this->_regionMapper = $regionMapper;
parent::__construct($options);
}
...but I get an exception:
Zend_Form_Exception: Only form elements and groups may be overloaded; variable of type "Mock_Model_RegionMapper_b19e528a" provided
What am I doing wrong?
© Stack Overflow or respective owner