Created
January 18, 2017 16:04
-
-
Save kenorb/2e78c9bdfed2c99d6e52dace6617a95d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = CWD; | |
$site_dir = NULL; | |
$dpl_dir = NULL; | |
while ($path != '/') { | |
if (file_exists($path . '/settings.php')) { | |
$site_dir = $path; | |
} | |
if (file_exists($path . '/index.php') && file_exists($path . '/includes/bootstrap.inc')) { | |
$dpl_dir = $path; | |
break; | |
} | |
$path = dirname($path); | |
} | |
if (!$dpl_dir) { | |
echo "No drupal directory found in or above current working directory. Aborting. \n"; | |
exit(1); | |
} | |
if (!$site_dir) { | |
$site_dir = $dpl_dir . '/sites/default'; | |
if (!file_exists($site_dir . '/settings.php')) { | |
echo "No configured site found. Aborting.\n"; | |
exit(1); | |
} | |
} | |
$_SERVER['HTTP_HOST'] = basename($site_dir); | |
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
define('DRUPAL_ROOT', $dpl_dir); | |
set_include_path($dpl_dir . PATH_SEPARATOR . get_include_path()); | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get dirname of the script | |
DIR="$(dirname $(readlink "$0"))" | |
# assume the boostrap script is stored in the same directory | |
php "$DIR/drun-phpunit.php" "$(pwd)" --bootstrap "$DIR/bootstrap.inc.php" "$@" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'PHP/CodeCoverage/Filter.php'; | |
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT'); | |
if (extension_loaded('xdebug')) { | |
xdebug_disable(); | |
} | |
if (strpos('/usr/bin/php', '@php_bin') === 0) { | |
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); | |
} | |
require_once 'PHPUnit/Autoload.php'; | |
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main'); | |
define('CWD', $_SERVER['argv'][1]); | |
unset($_SERVER['argv'][1]); | |
$command = new PHPUnit_TextUI_Command; | |
$command->run($_SERVER['argv']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment