From e401168c45b6339b49c10a8bd6617369a6018316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9za=20B=C3=BAza?= Date: Mon, 4 Mar 2019 10:11:50 +0100 Subject: [PATCH 1/3] Add Magento Framework as a dependency Since the module depends on the Magento DI which is provided by the Magento Framework, this has to be added to composer.json as a requirement. --- composer.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index dc4ec79..9b2621c 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ ], "require": { "php": ">=7.1", - "behat/behat": "^3.5.0" + "behat/behat": "^3.5.0", + "magento/framework": ">=100.1" }, "require-dev": { "bex/behat-test-runner": "^1.2.1", @@ -28,5 +29,11 @@ "psr-0": { "Bex\\Behat\\Magento2Extension": "src/" } - } + }, + "repositories": [ + { + "type": "composer", + "url": "https://repo.magento.com/" + } + ] } From 0415803f3e5fecfb8dc4e3bc274fb8ea66e892df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9za=20B=C3=BAza?= Date: Mon, 4 Mar 2019 10:24:11 +0100 Subject: [PATCH 2/3] Add Symfony component dependencies Include container related dependencies (container-interop/container-interop, symfony/dependency-injection) in composer.json. Also add symfony/event-dispatcher package as mandatory dependency. --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9b2621c..4b10189 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,10 @@ "require": { "php": ">=7.1", "behat/behat": "^3.5.0", - "magento/framework": ">=100.1" + "magento/framework": ">=100.1", + "container-interop/container-interop": "^1.2", + "symfony/dependency-injection": ">=2.0", + "symfony/event-dispatcher": ">=2.0" }, "require-dev": { "bex/behat-test-runner": "^1.2.1", From abdc8bf888daad8a3fc77aac7a3759ce759f728a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9za=20B=C3=BAza?= Date: Mon, 4 Mar 2019 10:25:38 +0100 Subject: [PATCH 3/3] Code cleanup Remove unused PHP use statements. --- composer.json | 5 ++++- .../HelperContainer/Magento2SymfonyServiceContainer.php | 9 --------- .../Listener/MagentoObjectManagerInitializer.php | 6 +++--- .../ServiceContainer/Magento2Extension.php | 1 - 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 4b10189..a2cf860 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,10 @@ "magento/framework": ">=100.1", "container-interop/container-interop": "^1.2", "symfony/dependency-injection": ">=2.0", - "symfony/event-dispatcher": ">=2.0" + "symfony/event-dispatcher": ">=2.0", + "magento/module-authorization": "*", + "magento/module-user": "*", + "magento/module-backend": "*" }, "require-dev": { "bex/behat-test-runner": "^1.2.1", diff --git a/src/Bex/Behat/Magento2Extension/HelperContainer/Magento2SymfonyServiceContainer.php b/src/Bex/Behat/Magento2Extension/HelperContainer/Magento2SymfonyServiceContainer.php index 28b6f9a..73636ce 100644 --- a/src/Bex/Behat/Magento2Extension/HelperContainer/Magento2SymfonyServiceContainer.php +++ b/src/Bex/Behat/Magento2Extension/HelperContainer/Magento2SymfonyServiceContainer.php @@ -4,15 +4,6 @@ use Bex\Behat\Magento2Extension\Service\MagentoObjectManager; use Interop\Container\ContainerInterface; -use Magento\Authorization\Model\ResourceModel\Role\Collection; -use Magento\Backend\Model\Auth\Session; -use Magento\Framework\App\Bootstrap; -use Magento\Framework\App\Filesystem\DirectoryList; -use Magento\Framework\App\ObjectManager; -use Magento\Framework\App\State; -use Magento\Framework\ObjectManager\ConfigLoaderInterface; -use Magento\Framework\Registry; -use Magento\User\Model\UserFactory; use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyServiceContainer; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; diff --git a/src/Bex/Behat/Magento2Extension/Listener/MagentoObjectManagerInitializer.php b/src/Bex/Behat/Magento2Extension/Listener/MagentoObjectManagerInitializer.php index c16ce94..9f108b0 100644 --- a/src/Bex/Behat/Magento2Extension/Listener/MagentoObjectManagerInitializer.php +++ b/src/Bex/Behat/Magento2Extension/Listener/MagentoObjectManagerInitializer.php @@ -5,8 +5,6 @@ use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested; use Behat\Testwork\EventDispatcher\Event\SuiteTested; use Bex\Behat\Magento2Extension\ServiceContainer\Config; -use Magento\Authorization\Model\ResourceModel\Role\Collection; -use Magento\Backend\Model\Auth\Session; use Magento\Framework\App\Area; use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; @@ -14,8 +12,10 @@ use Magento\Framework\App\State; use Magento\Framework\ObjectManager\ConfigLoaderInterface; use Magento\Framework\Registry; -use Magento\User\Model\UserFactory; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Magento\Authorization\Model\ResourceModel\Role\Collection; +use Magento\Backend\Model\Auth\Session; +use Magento\User\Model\UserFactory; class MagentoObjectManagerInitializer implements EventSubscriberInterface { diff --git a/src/Bex/Behat/Magento2Extension/ServiceContainer/Magento2Extension.php b/src/Bex/Behat/Magento2Extension/ServiceContainer/Magento2Extension.php index 751ee5f..5adb93d 100644 --- a/src/Bex/Behat/Magento2Extension/ServiceContainer/Magento2Extension.php +++ b/src/Bex/Behat/Magento2Extension/ServiceContainer/Magento2Extension.php @@ -4,7 +4,6 @@ use Behat\Testwork\ServiceContainer\Extension; use Behat\Testwork\ServiceContainer\ExtensionManager; -use Magento\Framework\App\Http as HttpApplication; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder;