function performValidate()
 {
   include_once(LIMB_DIR . '/core/commands/FormValidateCommand.class.php');
   $command = new FormValidateCommand($this->form_id, $this->validator);
   return $command->perform();
 }
  function testPerformNotValid()
  {
    $validator = new MockValidator($this);

    $form_command = new FormValidateCommand($form_id = 'test_form', $validator);

    $dataspace = new Dataspace();
    $this->toolkit->expectOnce('getDataspace');
    $this->toolkit->setReturnReference('getDataspace', $dataspace);

    // Validator is not valid
    $validator->expectOnce('validate', array($dataspace));
    $validator->expectOnce('isValid');
    $validator->setReturnValue('isValid', false);

    $form_component = new MockFormComponent($this);
    $view = new Component();

    // We have to transfer error list and dataspace to the form component
    $error_list = new ErrorList();
    $validator->expectOnce('getErrorList');
    $validator->setReturnReference('getErrorList', $error_list);

    $this->toolkit->expectOnce('getView');
    $this->toolkit->setReturnReference('getView', $view);

    $view->addChild($form_component, $form_id);

    $form_component->expectOnce('setErrors', array($error_list));
    $form_component->expectOnce('registerDataSource', array($dataspace));

    $this->assertEqual($form_command->perform(), LIMB_STATUS_FORM_NOT_VALID);

    $form_component->tally();
    $validator->tally();
  }