Skip to content

Commit

Permalink
Force legacy controller in context for customer behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jolelievre committed Oct 24, 2023
1 parent 84e226c commit 1449c68
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:$/
*/
Expand Down

0 comments on commit 1449c68

Please sign in to comment.