Merge pull request #10893 from lekoala/patch-42

include silverstripe core files into roots
This commit is contained in:
Maxime Rainville 2023-08-02 10:19:14 +12:00 committed by GitHub
commit 6ed50b5279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -650,6 +650,11 @@ class ClassManifest
} }
$this->children[$lowerAncestor][$lowerClassName] = $className; $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 { } else {
$this->roots[$lowerClassName] = $className; $this->roots[$lowerClassName] = $className;
} }

View File

@ -87,6 +87,14 @@ class ClassInfoTest extends SapphireTest
$subclassesWithoutBase, $subclassesWithoutBase,
ClassInfo::subclassesFor('silverstripe\\core\\tests\\classinfotest\\baseclass', false) 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() public function testClassName()