From 7efd7528b324497c38a9a3abe1cccacf3e913d3a Mon Sep 17 00:00:00 2001 From: Jisse Reitsma Date: Mon, 16 Oct 2023 15:52:28 +0200 Subject: [PATCH] Pending changes --- ComponentCollector/AbstractComponentCollector.php | 3 ++- .../ComponentDetector/ModuleXmlComponentDetectorTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ComponentCollector/AbstractComponentCollector.php b/ComponentCollector/AbstractComponentCollector.php index 21614c0..76ea3db 100644 --- a/ComponentCollector/AbstractComponentCollector.php +++ b/ComponentCollector/AbstractComponentCollector.php @@ -31,7 +31,8 @@ protected function findComponentsByModuleName(string $content, bool $hardRequire if (!preg_match_all('/([A-Za-z0-9]+)_([A-Za-z0-9]+)::/', $content, $matches)) { return []; } - + + $components = []; foreach ($matches[0] as $matchIndex => $match) { $moduleName = $matches[1][$matchIndex] . '_' . $matches[2][$matchIndex]; $components[] = $this->componentFactory->createByModuleName($moduleName, $hardRequirement); diff --git a/Test/Integration/ComponentDetector/ModuleXmlComponentDetectorTest.php b/Test/Integration/ComponentDetector/ModuleXmlComponentDetectorTest.php index 08c7c22..480f567 100644 --- a/Test/Integration/ComponentDetector/ModuleXmlComponentDetectorTest.php +++ b/Test/Integration/ComponentDetector/ModuleXmlComponentDetectorTest.php @@ -4,6 +4,7 @@ use Magento\Framework\App\ObjectManager; use PHPUnit\Framework\TestCase; +use Yireo\ExtensionChecker\ComponentDetector\ModuleXmlComponentDetector; use Yireo\ExtensionChecker\ComponentDetector\PhpClassComponentDetector; use Yireo\ExtensionChecker\Test\Integration\Behaviour\AssertContainsByComponentName; @@ -13,7 +14,7 @@ class ModuleXmlComponentDetectorTest extends TestCase public function testGetComponentsByModuleName() { - $componentDetector = ObjectManager::getInstance()->get(PhpClassComponentDetector::class); + $componentDetector = ObjectManager::getInstance()->get(ModuleXmlComponentDetector::class); $components = $componentDetector->getComponentsByModuleName('Magento_Catalog'); $this->assertNotEmpty($components); $this->assertContainsByComponentName('Magento_Checkout', $components);