Skip to content

Commit d77552b

Browse files
FIX Make sure tests run in draft stage by default (#308)
The code running in the browser will have the stage set by middleware and other mechanisms, so this only applies to the in-CLI context which sets up fixtures etc.
1 parent 5eda9ca commit d77552b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Context/SilverStripeContext.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use SilverStripe\MinkFacebookWebDriver\FacebookWebDriver;
2020
use SilverStripe\ORM\DataObject;
2121
use SilverStripe\TestSession\TestSessionEnvironment;
22+
use SilverStripe\Versioned\Versioned;
2223
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
2324

2425
/**
@@ -284,6 +285,9 @@ public function before(BeforeScenarioScope $event)
284285
if (class_exists(SiteTree::class)) {
285286
SiteTree::reset();
286287
}
288+
if (class_exists(Versioned::class)) {
289+
Versioned::set_stage(Versioned::DRAFT);
290+
}
287291
}
288292

289293
/**

0 commit comments

Comments
 (0)