Skip to content

Commit

Permalink
BUG include silverstripe core files into roots
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala authored and Maxime Rainville committed Aug 1, 2023
1 parent d9f40a2 commit 359cb14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/Manifest/ClassManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,11 @@ public function handleFile($basename, $pathname, $includeTests)
}
$this->children[$lowerAncestor][$lowerClassName] = $className;
}

// If the class extends a core class, add class to roots
if (strpos($ancestor, 'SilverStripe\\Control') === 0) {
$this->roots[$lowerAncestor] = $ancestor;
}
} else {
$this->roots[$lowerClassName] = $className;
}
Expand Down
8 changes: 8 additions & 0 deletions tests/php/Core/ClassInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public function testSubclassesFor()
$subclassesWithoutBase,
ClassInfo::subclassesFor('silverstripe\\core\\tests\\classinfotest\\baseclass', false)
);

// Check that core classes are present (eg: Email subclasses)
$emailClasses = ClassInfo::subclassesFor(\SilverStripe\Control\Email\Email::class);
$this->assertArrayHasKey(
'silverstripe\\control\\tests\\email\\emailtest\\emailsubclass',
$emailClasses,
'It contains : ' . json_encode($emailClasses)
);
}

public function testClassName()
Expand Down

0 comments on commit 359cb14

Please sign in to comment.