Fixture on website throws exception
Hello, how are you?
I got this little fixture:
scope:
website: # Initialize websites
- website_id: 2
code: usa_website
name: USA Website
default_group_id: 2
And just this test:
class FixtureTest extends EcomDev_PHPUnit_Test_Case
{
/**
* @loadFixture website
*/
public function testThereAreProducts()
{
$this->setCurrentStore(1);
}
}
But this goes wrong:
PHP Fatal error: Uncaught exception 'Mage_Core_Exception' with message 'Cannot complete this operation from non-admin area.' in mage-1810/app/Mage.php:595
Stack trace:
#0 mage-1810/app/code/core/Mage/Core/Model/Abstract.php(517): Mage::throwException('Cannot complete...')
#1 mage-1810/app/code/core/Mage/Core/Model/Website.php(472): Mage_Core_Model_Abstract->_protectFromNonAdmin()
#2 mage-1810/app/code/core/Mage/Core/Model/Abstract.php(479): Mage_Core_Model_Website->_beforeDelete()
#3 mage-1810/.modman/EcomDev_PHPUnit/app/code/community/EcomDev/PHPUnit/Model/Fixture/Processor/Scope.php(190): Mage_Core_Model_Abstract->delete()
#4 mage-1810/.modman/EcomDev_PHPUnit/app/code/community/EcomDev/PHPUnit/Model/Fixture.php(486): EcomDev_PHPUnit_Model_Fixture_Processor_Scope->d in mage-1810/app/Mage.php on line 595
Process finished with exit code 255
The Mage::registry('isSecureArea') is false, so it fails.
Don't really know how to fix that without setting the registry flag every time or if I just did something wrong.
I'm having exactly the same problem using the current dev-branch (latest commit bfa5970e2dd63704d05c4209ee5aa7f6322e2f91)
and did you solve it?
please try this one: https://github.com/IvanChepurnyi/EcomDev_PhpUnit I don't know if it is solved there but it's more up-to-date than this repo.
The current repo is most up-to-date. I have full control over it now.