add condition to prevent running endTestSession() twice

reformatted with space indent
This commit is contained in:
Jeffrey Guo 2015-12-18 15:42:48 +13:00
parent f41bb0fc53
commit 299cde3c90

View File

@ -83,13 +83,13 @@ class SilverStripeAwareInitializer implements InitializerInterface
public function __destruct() public function __destruct()
{ {
file_put_contents('php://stdout', "Killing test session environment..."); // Add condition here as register_shutdown_function() also calls this in __construct()
if($this->testSessionEnvironment) { if($this->testSessionEnvironment) {
file_put_contents('php://stdout', "Killing test session environment...");
$this->testSessionEnvironment->endTestSession(); $this->testSessionEnvironment->endTestSession();
$this->testSessionEnvironment = null;
file_put_contents('php://stdout', " done!" . PHP_EOL);
} }
file_put_contents('php://stdout', " done!" . PHP_EOL);
} }
/** /**