Skip to content

Commit

Permalink
BUG Fix PHPUnit autoloading problems in text collector
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Aug 9, 2012
1 parent 1f4b5db commit ec17d36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions i18n/i18nTextCollector.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ public function collectFromTemplate($content, $fileName, $module) {
*/ */
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) {
Expand Down

0 comments on commit ec17d36

Please sign in to comment.