From 398c65c54035f6cab702accdb757cf81f9bdae03 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 19 Jun 2018 16:04:43 +1200 Subject: [PATCH 1/2] Re-enable test for removing custom rules from live stage when forms are published with deletions --- tests/Model/UserDefinedFormTest.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/Model/UserDefinedFormTest.php b/tests/Model/UserDefinedFormTest.php index 24a0ee4..1d40f92 100644 --- a/tests/Model/UserDefinedFormTest.php +++ b/tests/Model/UserDefinedFormTest.php @@ -283,12 +283,9 @@ class UserDefinedFormTest extends FunctionalTest $this->assertNotEmpty($liveRule); // Publish form, it should remove this rule - /** - * @todo Currently failing, revisit once https://github.com/silverstripe/silverstripe-versioned/issues/34 is resolved - */ - // $form->publishRecursive(); - // $liveRule = Versioned::get_one_by_stage(EditableCustomRule::class, 'Live', "\"EditableCustomRule_Live\".\"ID\" = $ruleID"); - // $this->assertEmpty($liveRule); + $form->publishRecursive(); + $liveRule = Versioned::get_one_by_stage(EditableCustomRule::class, 'Live', "\"EditableCustomRule_Live\".\"ID\" = $ruleID"); + $this->assertEmpty($liveRule); } public function testUnpublishing() From eddfa10cd33ffdd16cad806e6f7e49c44a16e000 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Tue, 19 Jun 2018 16:14:36 +1200 Subject: [PATCH 2/2] Remove cache from get_one_by_stage calls in tests --- tests/Model/UserDefinedFormTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Model/UserDefinedFormTest.php b/tests/Model/UserDefinedFormTest.php index 1d40f92..d93e4ab 100644 --- a/tests/Model/UserDefinedFormTest.php +++ b/tests/Model/UserDefinedFormTest.php @@ -297,7 +297,7 @@ class UserDefinedFormTest extends FunctionalTest $form->publishRecursive(); // assert that it exists and has a field - $live = Versioned::get_one_by_stage(UserDefinedForm::class, 'Live', "\"UserDefinedForm_Live\".\"ID\" = $form->ID"); + $live = Versioned::get_one_by_stage(UserDefinedForm::class, 'Live', "\"UserDefinedForm_Live\".\"ID\" = $form->ID", false); $this->assertTrue(isset($live)); $this->assertEquals(2, DB::query("SELECT COUNT(*) FROM \"EditableFormField_Live\"")->value()); @@ -305,7 +305,7 @@ class UserDefinedFormTest extends FunctionalTest // unpublish $form->doUnpublish(); - $this->assertNull(Versioned::get_one_by_stage(UserDefinedForm::class, 'Live', "\"UserDefinedForm_Live\".\"ID\" = $form->ID")); + $this->assertNull(Versioned::get_one_by_stage(UserDefinedForm::class, 'Live', "\"UserDefinedForm_Live\".\"ID\" = $form->ID", false)); $this->assertEquals(0, DB::query("SELECT COUNT(*) FROM \"EditableFormField_Live\"")->value()); }