mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix PHPUnit autoloading problems in text collector
This commit is contained in:
parent
1f4b5db2db
commit
ec17d368be
@ -329,6 +329,14 @@ class i18nTextCollector extends Object {
|
|||||||
function collectFromEntityProviders($filePath, $module = null) {
|
function collectFromEntityProviders($filePath, $module = null) {
|
||||||
$entities = array();
|
$entities = array();
|
||||||
|
|
||||||
|
// HACK Ugly workaround to avoid "Cannot redeclare class PHPUnit_Framework_TestResult" error
|
||||||
|
// when running text collector with PHPUnit 3.4. There really shouldn't be any dependencies
|
||||||
|
// here, but the class reflection enforces autloading of seemingly unrelated classes.
|
||||||
|
// The main problem here is the CMSMenu class, which iterates through test classes,
|
||||||
|
// which in turn trigger autoloading of PHPUnit.
|
||||||
|
$phpunitwrapper = PhpUnitWrapper::inst();
|
||||||
|
$phpunitwrapper->init();
|
||||||
|
|
||||||
$classes = ClassInfo::classes_for_file($filePath);
|
$classes = ClassInfo::classes_for_file($filePath);
|
||||||
if($classes) foreach($classes as $class) {
|
if($classes) foreach($classes as $class) {
|
||||||
// Not all classes can be instanciated without mandatory arguments,
|
// Not all classes can be instanciated without mandatory arguments,
|
||||||
|
Loading…
Reference in New Issue
Block a user