public function testLoadDataFromIgnoreFalseish()
 {
     $form = new Form(new Controller(), 'Form', new FieldList(new TextField('Biography', 'Biography', 'Custom Default')), new FieldList());
     $captainNoDetails = $this->objFromFixture('FormTest_Player', 'captainNoDetails');
     $captainWithDetails = $this->objFromFixture('FormTest_Player', 'captainWithDetails');
     $form->loadDataFrom($captainNoDetails, Form::MERGE_IGNORE_FALSEISH);
     $this->assertEquals($form->getData(), array('Biography' => 'Custom Default'), 'LoadDataFrom() doesn\'t overwrite fields when MERGE_IGNORE_FALSEISH set and values are false-ish');
     $form->loadDataFrom($captainWithDetails, Form::MERGE_IGNORE_FALSEISH);
     $this->assertEquals($form->getData(), array('Biography' => 'Bio 1'), 'LoadDataFrom() does overwrite fields when MERGE_IGNORE_FALSEISH set and values arent false-ish');
 }
 /**
  * Get link to schema url for a given form
  *
  * @param Form $form
  * @return string
  */
 protected function getSchemaLinkForForm(Form $form)
 {
     $parts = [$this->Link('schema'), $form->getName()];
     if (($record = $form->getRecord()) && $record->isInDB()) {
         $parts[] = $record->ID;
     } elseif (($data = $form->getData()) && !empty($data['ID'])) {
         $parts[] = $data['ID'];
     }
     return Controller::join_links($parts);
 }
 /**
  * Returns any errors there may be.
  *
  * @return null|array
  */
 public function validate()
 {
     $this->errors = null;
     $this->php($this->form->getData());
     return $this->errors;
 }