EcomDev_PHPUnit icon indicating copy to clipboard operation
EcomDev_PHPUnit copied to clipboard

Fixture on website throws exception

Open ScreamingDev opened this issue 11 years ago • 4 comments

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.

ScreamingDev avatar Feb 16 '14 16:02 ScreamingDev

I'm having exactly the same problem using the current dev-branch (latest commit bfa5970e2dd63704d05c4209ee5aa7f6322e2f91)

christopheraue avatar Apr 28 '14 14:04 christopheraue

and did you solve it?

michael-sauerwald avatar Aug 22 '14 18:08 michael-sauerwald

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.

ScreamingDev avatar Aug 25 '14 06:08 ScreamingDev

The current repo is most up-to-date. I have full control over it now.

IvanChepurnyi avatar Aug 26 '14 11:08 IvanChepurnyi