diff --git a/tests/Integration/Behaviour/Features/Context/CustomerManagerFeatureContext.php b/tests/Integration/Behaviour/Features/Context/CustomerManagerFeatureContext.php index cbe5ce18444f2..229af5b7effbc 100644 --- a/tests/Integration/Behaviour/Features/Context/CustomerManagerFeatureContext.php +++ b/tests/Integration/Behaviour/Features/Context/CustomerManagerFeatureContext.php @@ -26,7 +26,9 @@ namespace Tests\Integration\Behaviour\Features\Context; +use AdminController; use Behat\Gherkin\Node\TableNode; +use Context; use Customer; use Exception; use PHPUnit\Framework\Assert; @@ -70,6 +72,18 @@ class CustomerManagerFeatureContext extends AbstractPrestaShopFeatureContext */ protected $customerRegistry = []; + /** + * @BeforeFeature + */ + public static function prepareBeforeFeature() + { + // The Customer legacy object update method only updates groups when a controller is set in the context, + // so until the handlers are no longer based on legacy ObjectModel we need to set it manually + if (!Context::getContext()->controller) { + Context::getContext()->controller = new AdminController(); + } + } + /** * @When /^I create a customer "(.+)" with following properties:$/ */