Skip to content

Commit 175a171

Browse files
committed
Move constructor above other methods.
1 parent bb82da3 commit 175a171

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

tests/UnishTestCase.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,35 @@ abstract class UnishTestCase extends TestCase
2727

2828
private static $backendOutputDelimiter = 'DRUSH_BACKEND_OUTPUT_START>>>%s<<<DRUSH_BACKEND_OUTPUT_END';
2929

30+
public function __construct($name = null, array $data = [], $dataName = '')
31+
{
32+
parent::__construct($name, $data, $dataName);
33+
34+
// We read from env then globals then default to mysql.
35+
self::$db_url = getenv('UNISH_DB_URL') ?: (isset($GLOBALS['UNISH_DB_URL']) ? $GLOBALS['UNISH_DB_URL'] : 'mysql://root:@127.0.0.1');
36+
37+
// require_once __DIR__ . '/unish.inc';
38+
// list($unish_tmp, $unish_sandbox, $unish_drush_dir) = \unishGetPaths();
39+
$unish_sandbox = Path::join(dirname(__DIR__), 'sandbox');
40+
self::mkdir($unish_sandbox);
41+
$unish_cache = Path::join($unish_sandbox, 'cache');
42+
43+
self::$drush = self::getComposerRoot() . '/drush';
44+
45+
self::$sandbox = $unish_sandbox;
46+
self::$usergroup = isset($GLOBALS['UNISH_USERGROUP']) ? $GLOBALS['UNISH_USERGROUP'] : null;
47+
48+
self::setEnv(['CACHE_PREFIX' => $unish_cache]);
49+
$home = $unish_sandbox . '/home';
50+
self::setEnv(['HOME' => $home]);
51+
self::setEnv(['HOMEDRIVE' => $home]);
52+
$composer_home = $unish_cache . '/.composer';
53+
self::setEnv(['COMPOSER_HOME' => $composer_home]);
54+
self::setEnv(['ETC_PREFIX' => $unish_sandbox]);
55+
self::setEnv(['SHARE_PREFIX' => $unish_sandbox]);
56+
self::setEnv(['TEMP' => Path::join($unish_sandbox, 'tmp')]);
57+
}
58+
3059
/**
3160
* @return array
3261
*/
@@ -135,35 +164,6 @@ public static function getBackendOutputDelimiter()
135164
return self::$backendOutputDelimiter;
136165
}
137166

138-
public function __construct($name = null, array $data = [], $dataName = '')
139-
{
140-
parent::__construct($name, $data, $dataName);
141-
142-
// We read from env then globals then default to mysql.
143-
self::$db_url = getenv('UNISH_DB_URL') ?: (isset($GLOBALS['UNISH_DB_URL']) ? $GLOBALS['UNISH_DB_URL'] : 'mysql://root:@127.0.0.1');
144-
145-
// require_once __DIR__ . '/unish.inc';
146-
// list($unish_tmp, $unish_sandbox, $unish_drush_dir) = \unishGetPaths();
147-
$unish_sandbox = Path::join(dirname(__DIR__), 'sandbox');
148-
self::mkdir($unish_sandbox);
149-
$unish_cache = Path::join($unish_sandbox, 'cache');
150-
151-
self::$drush = self::getComposerRoot() . '/drush';
152-
153-
self::$sandbox = $unish_sandbox;
154-
self::$usergroup = isset($GLOBALS['UNISH_USERGROUP']) ? $GLOBALS['UNISH_USERGROUP'] : null;
155-
156-
self::setEnv(['CACHE_PREFIX' => $unish_cache]);
157-
$home = $unish_sandbox . '/home';
158-
self::setEnv(['HOME' => $home]);
159-
self::setEnv(['HOMEDRIVE' => $home]);
160-
$composer_home = $unish_cache . '/.composer';
161-
self::setEnv(['COMPOSER_HOME' => $composer_home]);
162-
self::setEnv(['ETC_PREFIX' => $unish_sandbox]);
163-
self::setEnv(['SHARE_PREFIX' => $unish_sandbox]);
164-
self::setEnv(['TEMP' => Path::join($unish_sandbox, 'tmp')]);
165-
}
166-
167167
/**
168168
* We used to assure that each class starts with an empty sandbox directory and
169169
* a clean environment except for the SUT. History: http://drupal.org/node/1103568.

0 commit comments

Comments
 (0)