Skip to content

Commit

Permalink
Added option to extend class namespace candidated from config['projec…
Browse files Browse the repository at this point in the history
…tNamespaces'] in ClassResolverTrait.php (#10993)

FRW-8638 Extended class namespace candidates.
  • Loading branch information
spryker-release-bot authored Jul 25, 2024
1 parent 72b8e1a commit 6bf8295
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ protected function getClassNameCandidates(string $classNamePattern, string $modu
{
$classNameFromConfiguration = $this->getClassNameFromConfiguration($classNamePattern, $moduleName);

$config = Configuration::config();

if (!$applicationName) {
$config = Configuration::config();
$namespaceParts = explode('\\', $config['namespace']);
// When `application` is configured in the codeception.yml use this value instead of guessing it.
$applicationName = $config['application'] ?? $namespaceParts[1];
Expand All @@ -83,6 +84,12 @@ protected function getClassNameCandidates(string $classNamePattern, string $modu
$classNameCandidates = [];
$classNameCandidates[] = $classNameFromConfiguration;

if (isset($config['projectNamespaces']) && is_array($config['projectNamespaces'])) {
foreach ($config['projectNamespaces'] as $projectNamespace) {
$classNameCandidates[] = sprintf($classNamePattern, $projectNamespace, $applicationName, $moduleName);
}
}

foreach ($this->coreNamespaces as $coreNamespace) {
$classNameCandidates[] = sprintf($classNamePattern, $coreNamespace, $applicationName, $moduleName);
}
Expand Down

0 comments on commit 6bf8295

Please sign in to comment.