Skip to content

Instantly share code, notes, and snippets.

@simonwelsh
Created December 19, 2013 20:20
Show Gist options
  • Save simonwelsh/8045584 to your computer and use it in GitHub Desktop.
Save simonwelsh/8045584 to your computer and use it in GitHub Desktop.
diff --git a/hphp/test/frameworks/run.php b/hphp/test/frameworks/run.php
index 4c1f736..0a5f0d2 100755
--- a/hphp/test/frameworks/run.php
+++ b/hphp/test/frameworks/run.php
@@ -1563,6 +1563,74 @@ class PHPUnit extends Framework {
}
}
+class SilverStripe extends Framework {
+ public function __construct(string $name) { parent::__construct($name); }
+ protected function getInfo(): Map {
+ return Map {
+ 'install_root' => __DIR__.'/frameworks/silverstripe',
+ 'git_path' => 'https://github.com/silverstripe/'
+ . 'silverstripe-installer.git',
+ 'git_commit' => 'c7fe54d08200e09094c7a6087572cc9d116c5774',
+ 'test_path' => __DIR__.'/frameworks/silverstripe',
+ };
+ }
+
+ protected function install(): void {
+ parent::install();
+ verbose("Installing dependencies.\n", Options::$verbose);
+
+ $dependencies_install_cmd = get_runtime_build()." ".__DIR__.
+ "/composer.phar require silverstripe/sqlite3 dev-master";
+ $install_ret = run_install($dependencies_install_cmd, $this->getInstallRoot(),
+ ProxyInformation::$proxies);
+
+ if ($install_ret !== 0) {
+ remove_dir_recursive($this->getInstallRoot());
+ error_and_exit("Couldn't download dependencies for ".$this->getName().
+ ". Removing framework. \n", Options::$csv_only);
+ }
+
+ verbose(
+ "Creating a _ss_environment file for setting SQLite adapter.\n",
+ Options::$verbose
+ );
+
+ $contents = <<<'ENV_FILE'
+<?php
+define('SS_DATABASE_SERVER', 'localhost');
+define('SS_DATABASE_USERNAME', 'root');
+define('SS_DATABASE_PASSWORD', '');
+define('SS_DATABASE_NAME', 'tests');
+define('SS_ENVIRONMENT_TYPE', 'dev');
+define('SS_DATABASE_CLASS', 'SQLiteDatabase');
+
+global $_FILE_TO_URL_MAPPING;
+$_FILE_TO_URL_MAPPING[__DIR__] = 'http://localhost';
+ENV_FILE;
+
+ file_put_contents(
+ $this->getInstallRoot()."/_ss_environment.php", $contents
+ );
+ }
+
+ protected function isInstalled(): bool {
+ $extra_files = Set {
+ $this->getInstallRoot()."/sqlite3",
+ $this->getInstallRoot()."/_ss_environment.php",
+ };
+
+ if (file_exists($this->getInstallRoot())) {
+ foreach ($extra_files as $file) {
+ if (!file_exists($file)) {
+ remove_dir_recursive($this->getInstallRoot());
+ return false;
+ }
+ }
+ }
+ return parent::isInstalled();
+ }
+}
+
class Slim extends Framework {
public function __construct(string $name) { parent::__construct($name); }
protected function getInfo(): Map {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment