public function testFrozenContainersHaveNoClientValidation()
 {
     $container = new HTML_QuickForm2_ContainerImpl('aContainer');
     $ruleContainer = $this->getMock('HTML_QuickForm2_Rule', array('validateOwner', 'getJavascriptCallback'), array($container));
     $ruleContainer->expects($this->never())->method('getJavascriptCallback');
     $container->addRule($ruleContainer, HTML_QuickForm2_Rule::CLIENT);
     $container->toggleFrozen(true);
     $this->assertEquals('', $container->render(HTML_QuickForm2_Renderer::factory('default'))->getJavascriptBuilder()->getFormJavascript());
 }
 public function testValidate()
 {
     $cValidate = new HTML_QuickForm2_ContainerImpl('validate');
     $el1 = $cValidate->appendChild(new HTML_QuickForm2_ElementImpl2('foo'));
     $el2 = $cValidate->appendChild(new HTML_QuickForm2_ElementImpl2('bar'));
     $ruleTrue1 = $this->getMock('HTML_QuickForm2_Rule', array('checkValue'), array($cValidate, 'irrelevant message'));
     $ruleTrue1->expects($this->once())->method('checkValue')->will($this->returnValue(true));
     $ruleFalse = $this->getMock('HTML_QuickForm2_Rule', array('checkValue'), array($el1, 'some error'));
     $ruleFalse->expects($this->once())->method('checkValue')->will($this->returnValue(false));
     $ruleTrue2 = $this->getMock('HTML_QuickForm2_Rule', array('checkValue'), array($el2, 'irrelevant message'));
     $ruleTrue2->expects($this->once())->method('checkValue')->will($this->returnValue(true));
     $cValidate->addRule($ruleTrue1);
     $el1->addRule($ruleFalse);
     $el2->addRule($ruleTrue2);
     $this->assertFalse($cValidate->validate());
     $this->assertEquals('', $cValidate->getError());
 }