So I've set up testing in my ZF 1.9.5 application thanks to this tutorial, I am able to test my controllers, now I want to create a test for a form. However, I'm having the problem that PHPUnit can't find my form.
Fatal error: Class 'Default_Form_AccountProfile' not found
I'm extending PHPUnit_Framework_TestCase
instead of Zend_Test_PHPUnit_ControllerTestCase
since it is not a controller. Is that the right thing to do? Here is my test:
<?php
class AccountProfileTest extends PHPUnit_Framework_TestCase
{
public function testPopulate()
{
$form = new Default_Form_AccountProfile();
$user = array(
'firstName' => 'Joe',
'lastName' => 'Schmoe'
);
$form->populate($user);
$this->assertEquals($form->getElement('firstName')->getValue(), 'Joe');
$this->assertEquals($form->getElement('lastName')->getValue(), 'Schmoe');
}
}
What am I doing wrong? What would be the correct way to test a form in Zend Framework?