Skip to content

Intercepted classes don't work correctly when using ReflectionClass - Integration Tests #18668

Open
@domeglic

Description

@domeglic

Summary (*)

Creating a store inside integration tests doesn't work if there is a plugin defined for Magento\Framework\App\Config.

I have a test that requires a new store and it is not possible to save it. There is an exception "Property data does not exist".
When saving a store, method \Magento\TestFramework\Store\StoreManager::reinitStores is called, the reflection class will only have properties from the Interceptor class and not \Magento\TestFramework\App\Config.

PHP: 7.0
Magento: 2.2.6

Examples (*)

Create a plugin for Config, doesn't matter what it does:

<type name="Magento\Framework\App\Config">
        <plugin name="some_plugin" type="Some\Vendor\Plugin\FrameworkAppConfig" />
</type>

Have an integration test that creates a new store:

$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(\Magento\Store\Model\Store::class)->create();  
$store->setCode('new_store)->setWebsiteId(1)->setGroupId(1)->setName('New store')->setIsActive(true);  
\Magento\TestFramework\Helper\Bootstrap::getObjectManager(\Magento\Store\Model\ResourceModel\Store::class)->save($store);

Proposed solution

Metadata

Metadata

Assignees

Labels

Area: Test frameworkComponent: ConfigIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReproduced 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 releaseSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

Status

Pull Request In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions