Open zuernBernhard opened 7 years ago
Here is the working step definition:
/**
* @Given I make sure the customer :mail does not exist in the :shop Shop
*/
public function iMakeSureTheCustomerDoesNotExistInTheShop($mail, $site)
{
$websites = Mage::app()->getWebsites();
foreach ($websites as $website) {
$name = $website->getName();
if ($site == $name) {
Mage::register('isSecureArea', true); /* set secure admin area*/
$customerModel = Mage::getModel('customer/customer');
$customerModel->setWebsiteId($website->getId());
$customer = $customerModel->loadByEmail($mail);
$customer->delete();
Mage::unregister('isSecureArea'); /* un set secure admin area*/
}
}
}
I have a behat test for the Customer-Registration in a Magento-Shop (1.8).
In order to rerun the test as often as I want As a developer I want the Test to clear the generated user account in a scenario hook
Possible Solution:
BUT this does not work.
Then I move the code into a Stepdefinition it works. :(