public function testDisplayIfInvalid()
 {
     $mockForm = $this->getMock('HTML_QuickForm2', array('validate', 'getValue'), array('invalid'));
     $mockForm->expects($this->once())->method('validate')->will($this->returnValue(false));
     $mockForm->expects($this->once())->method('getValue')->will($this->returnValue(array('foo' => 'bar')));
     $mockPage = $this->getMock('HTML_QuickForm2_Controller_Page', array('populateForm'), array($mockForm));
     $mockDisplay = $this->getMock('HTML_QuickForm2_Controller_Action', array('perform'));
     $mockDisplay->expects($this->once())->method('perform')->will($this->returnValue('display form'));
     $mockPage->addHandler('display', $mockDisplay);
     $controller = new HTML_QuickForm2_Controller('submit_invalid');
     $controller->addPage($mockPage);
     $this->assertEquals('display form', $mockPage->handle('submit'));
     $this->assertEquals(array('foo' => 'bar'), $controller->getValue());
 }