private function buildTestEnv()
{
$fs = new Filesystem();
if ($fs->exists(PHPUNIT_WEBROOT)) {
$fs->remove(PHPUNIT_WEBROOT);
}
// Create needed directories
@$fs->mkdir(PHPUNIT_ROOT . '/resources/files/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/app/cache/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/app/config/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/app/database/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/extensions/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/files/', 0777);
@$fs->mkdir(PHPUNIT_WEBROOT . '/theme/', 0777);
// Mirror in required assets.
$fs->mirror(TEST_ROOT . '/app/resources/', PHPUNIT_WEBROOT . '/app/resources/', null, ['override' => true]);
$fs->mirror(TEST_ROOT . '/app/theme_defaults/', PHPUNIT_WEBROOT . '/app/theme_defaults/', null, ['override' => true]);
$fs->mirror(TEST_ROOT . '/app/view/', PHPUNIT_WEBROOT . '/app/view/', null, ['override' => true]);
// Make sure we wipe the db file to start with a clean one
$fs->copy($this->boltdb, PHPUNIT_WEBROOT . '/app/database/bolt.db', true);
// Copy in config files
foreach ($this->configs as $config) {
$fs->copy($config, PHPUNIT_WEBROOT . '/app/config/' . basename($config), true);
}
// Copy in the theme
$name = basename($this->theme);
$fs->mirror($this->theme, PHPUNIT_WEBROOT . '/theme/' . $name);
// Set the theme name in config.yml
system('php ' . NUT_PATH . ' config:set theme ' . $name);
// Empty the cache
system('php ' . NUT_PATH . ' cache:clear');
}