<?php
if(DB::get_alternative_database_name()) {
  require_once BASE_PATH . '/vendor/autoload.php';
	
	// Register mailer
  if($mailer = Session::get('testsession.mailer')) {
    Email::set_mailer(new $mailer());
    Email::send_all_emails_to(null);
  }
  
  // Set mock date and time
  $date = Session::get('testsession.date');
  if($date) {
  	SS_Datetime::set_mock_now($date);
  }
}
<?php
if(
  Config::inst()->get('Security', 'token')
  && DB::get_alternative_database_name()
) {
  require_once BASE_PATH . '/vendor/autoload.php';
	
	// Register mailer
  if($mailer = Session::get('testsession.mailer')) {
    Email::set_mailer(new $mailer());
    Email::send_all_emails_to(null);
  }
  
  // Set mock date and time
  $date = Session::get('testsession.date');
  if($date) {
  	SS_Datetime::set_mock_now($date);
  }
}
Check for Security.token before setting test session state
Check for Security.token before setting test session state

Otherwise we'll get into a catch22 if it's not set:
The manifest includes this _config.php, which in turn
throws a fatal exception on the token not existing.
It would be recreated a couple of lines further down in Core.php
when the ConfigManifest is pushed, but never gets this far.
