|
@@ 38-65 (lines=28) @@
|
| 35 |
|
UserDefinedForm::class => [UserFormFieldEditorExtension::class], |
| 36 |
|
]; |
| 37 |
|
|
| 38 |
|
public function testRollbackToVersion() |
| 39 |
|
{ |
| 40 |
|
$this->markTestSkipped( |
| 41 |
|
'UserDefinedForm::rollback() has not been implemented completely' |
| 42 |
|
); |
| 43 |
|
|
| 44 |
|
// @todo |
| 45 |
|
$this->logInWithPermission('ADMIN'); |
| 46 |
|
$form = $this->objFromFixture(UserDefinedForm::class, 'basic-form-page'); |
| 47 |
|
|
| 48 |
|
$form->SubmitButtonText = 'Button Text'; |
| 49 |
|
$form->write(); |
| 50 |
|
$form->publishRecursive(); |
| 51 |
|
$origVersion = $form->Version; |
| 52 |
|
|
| 53 |
|
$form->SubmitButtonText = 'Updated Button Text'; |
| 54 |
|
$form->write(); |
| 55 |
|
$form->publishRecursive(); |
| 56 |
|
|
| 57 |
|
// check published site |
| 58 |
|
$updated = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', "\"UserDefinedForm\".\"ID\" = $form->ID"); |
| 59 |
|
$this->assertEquals($updated->SubmitButtonText, 'Updated Button Text'); |
| 60 |
|
|
| 61 |
|
$form->doRollbackTo($origVersion); |
| 62 |
|
|
| 63 |
|
$orignal = Versioned::get_one_by_stage(UserDefinedForm::class, 'Stage', "\"UserDefinedForm\".\"ID\" = $form->ID"); |
| 64 |
|
$this->assertEquals($orignal->SubmitButtonText, 'Button Text'); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testGetCMSFields() |
| 68 |
|
{ |
|
@@ 301-327 (lines=27) @@
|
| 298 |
|
$this->assertEquals(0, DB::query("SELECT COUNT(*) FROM \"EditableFormField_Live\"")->value()); |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
public function testDoRevertToLive() |
| 302 |
|
{ |
| 303 |
|
$this->logInWithPermission('ADMIN'); |
| 304 |
|
$form = $this->objFromFixture(UserDefinedForm::class, 'basic-form-page'); |
| 305 |
|
$field = $form->Fields()->First(); |
| 306 |
|
|
| 307 |
|
$field->Title = 'Title'; |
| 308 |
|
$field->write(); |
| 309 |
|
|
| 310 |
|
$form->publishRecursive(); |
| 311 |
|
|
| 312 |
|
$field->Title = 'Edited title'; |
| 313 |
|
$field->write(); |
| 314 |
|
|
| 315 |
|
// check that the published version is not updated |
| 316 |
|
$live = Versioned::get_one_by_stage(EditableFormField::class, 'Live', "\"EditableFormField_Live\".\"ID\" = $field->ID"); |
| 317 |
|
$this->assertInstanceOf(EditableFormField::class, $live); |
| 318 |
|
$this->assertEquals('Title', $live->Title); |
| 319 |
|
|
| 320 |
|
// revert back to the live data |
| 321 |
|
$form->doRevertToLive(); |
| 322 |
|
$form->flushCache(); |
| 323 |
|
|
| 324 |
|
$check = Versioned::get_one_by_stage(EditableFormField::class, 'Stage', "\"EditableFormField\".\"ID\" = $field->ID"); |
| 325 |
|
|
| 326 |
|
$this->assertEquals('Title', $check->Title); |
| 327 |
|
} |
| 328 |
|
|
| 329 |
|
public function testDuplicatingForm() |
| 330 |
|
{ |