Skip to content

Integration Test Annotation magentoAppArea breaks with some valid values #2907

Closed
@Vinai

Description

@Vinai

The following test breaks due to Annotation\AppArea trying to init the design.

/**
 * @magentoAppArea webapi_rest
 */
public function testTheModuleRegisteresAnAddressRepositoryPlugin()
{
    /** @var \Magento\TestFramework\Interception\PluginList $pluginList */
    $pluginList = $this->objectManager->get(PluginList::class);
    $pluginInfo = $pluginList->get(AddressRepositoryInterface::class, []);
    $this->assertSame(AddressRepositoryPlugin::class, $pluginInfo['example_module'[['instance']);
}

The relevant part of the stack trace is:

PHP Fatal error:  Uncaught InvalidArgumentException: Incorrect theme identification key in .../mage2-ce/vendor/magento/framework/View/Design/Theme/FlyweightFactory.php:56
Stack trace:
#0 .../mage2-ce/vendor/magento/module-theme/Model/View/Design.php(147): Magento\Framework\View\Design\Theme\FlyweightFactory->create(NULL, 'webapi_rest')
#1 .../mage2-ce/vendor/magento/module-theme/Model/View/Design.php(211): Magento\Theme\Model\View\Design->setDesignTheme(NULL)
Fatal error: Uncaught InvalidArgumentException: Incorrect theme identification key in .../mage2-ce/vendor/magento/framework/View/Design/Theme/FlyweightFactory.php on line 56
#2 .../mage2-ce/vendor/magento/framework/App/Area.php(256): Magento\Theme\Model\View\Design->setDefaultDesignTheme()
#3 .../mage2-ce/vendor/magento/framework/App/Area.php(214): Magento\Framework\App\Area->_initDesign()
InvalidArgumentException: Incorrect theme identification key in .../mage2-ce/vendor/magento/framework/View/Design/Theme/FlyweightFactory.php on line 56
#4 .../mage2-ce/vendor/magento/framework/App/Area.php(136): Magento\Framework\App\Area->_loadPart('design')

...

Magento\TestFramework\Annotation\AppArea->startTest() .../mage2-ce/dev/tests/integration/framework/Magento/TestFramework/EventManager.php:49
Magento\TestFramework\Application->loadArea() .../mage2-ce/dev/tests/integration/framework/Magento/TestFramework/Annotation/AppArea.php:82
Magento\TestFramework\Helper\Bootstrap->loadArea() .../mage2-ce/dev/tests/integration/framework/Magento/TestFramework/Application.php:615
Magento\Framework\App\Area->load() .../mage2-ce/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php:157
Magento\Framework\App\Area->_loadPart() .../mage2-ce/vendor/magento/framework/App/Area.php:136
Magento\Framework\App\Area->_initDesign() .../mage2-ce/vendor/magento/framework/App/Area.php:214
Magento\Theme\Model\View\Design->setDefaultDesignTheme() .../mage2-ce/vendor/magento/framework/App/Area.php:256
Magento\Theme\Model\View\Design->setDesignTheme() .../mage2-ce/vendor/magento/module-theme/Model/View/Design.php:211
Magento\Framework\View\Design\Theme\FlyweightFactory->create() .../mage2-ce/vendor/magento/module-theme/Model/View/Design.php:147

This is despite \Magento\TestFramework\Annotation\AppArea defining the valid areas as

/**
 * List of allowed areas
 *
 * @var array
 */
private $_allowedAreas = [
    \Magento\Framework\App\Area::AREA_GLOBAL,
    \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE,
    \Magento\Framework\App\Area::AREA_FRONTEND,
    'webapi_rest',
    'webapi_soap',
    'cron',
];

The same error happens for webapi_soap and cron, too.
The other ones, frontend, adminhtml and global work as expected.

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions