function testPublishingMultipleOptions() { $id = $this->form->ID; $this->form->Fields()->removeAll(); // test a editable option field $dropdown = new EditableDropdown(); $dropdown->write(); $checkbox = new EditableCheckboxGroupField(); $checkbox->write(); $option = new EditableOption(); $option->write(); $option2 = new EditableOption(); $option2->write(); $dropdown->Options()->add($option); $checkbox->Options()->add($option2); $this->form->Fields()->add($dropdown); $this->form->Fields()->add($checkbox); // upon adding it, it shouldn't be on the live site $live = Versioned::get_one_by_stage("UserDefinedForm", "Live", "\"UserDefinedForm_Live\".\"ID\" = {$id}"); $this->assertFalse($live); // and when published it should exist and the option $this->form->doPublish(); $live = Versioned::get_one_by_stage("UserDefinedForm", "Live", "\"UserDefinedForm_Live\".\"ID\" = {$id}"); $this->assertEquals($live->Fields()->Count(), 2); // check they have options attached foreach ($live->Fields() as $field) { $this->assertEquals($field->Options()->Count(), 1); } }