Merge pull request #7514 from dhensby/pulls/3.5/composer-autoload

Add composer autloading to v3
This commit is contained in:
Damian Mooyman 2017-11-02 11:41:35 +13:00 committed by GitHub
commit ef86b16854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 3 deletions

View File

@ -29,6 +29,16 @@
}
},
"autoload": {
"classmap": ["tests/behat/features/bootstrap"]
"psr-0": {
"SilverStripe\\": "src/",
"Zend_": "thirdparty/Zend/"
},
"classmap": [
"tests/behat/features/bootstrap",
"admin/code", "api", "cache", "cli", "control", "core", "dev", "email", "filesystem",
"forms", "i18n", "model", "oembed", "parsers", "search", "security", "tasks", "view",
"thirdparty/php-peg", "thirdparty/simpletest", "thirdparty/zend_translate_railsyaml"
],
"exclude-from-classmap": ["view/SSTemplateParser.php.inc", "dev/phpunit/PhpUnitWrapper.php"]
}
}

View File

@ -260,7 +260,7 @@ class Injector {
* @return Injector Reference to new active Injector instance
*/
public static function nest() {
$current = self::$instance;
$current = self::inst();
$new = clone $current;
$new->nestedFrom = $current;

View File

@ -223,7 +223,7 @@ class Config {
* @return Config Reference to new active Config instance
*/
public static function nest() {
$current = self::$instance;
$current = self::inst();
$new = clone $current;
$new->nestedFrom = $current;

View File

@ -171,6 +171,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
public function setUp() {
if (!defined('FRAMEWORK_PATH')) {
trigger_error(
'Missing constants, did you remember to include the test bootstrap in your phpunit.xml file?',
E_USER_WARNING
);
}
//nest config and injector for each test so they are effectively sandboxed per test
Config::nest();
Injector::nest();