Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 2.67 KB

annotations.md

File metadata and controls

38 lines (28 loc) · 2.67 KB
group title
testing
Using DocBlock Annotations

DocBlock annotations help to declare context in your code. In addition to built-in PHPUnit annotations, the Integration testing framework provides custom annotations described in this topic.

Quick overview

The following annotations are available in integration tests:

Name Annotation Format Description
Application Isolation @magentoAppIsolation `@magentoAppIsolation enabled disabled`
Configuration Fixture @magentoConfigFixture @magentoConfigFixture [<store_code>_store] <config_path> <config_value> Sets up configuration settings for a particular test. The list of settings is stored in the core_config_data database table. After the test execution, the settings revert to their original state.
Database Isolation @magentoDbIsolation `@magentoDbIsolation enabled disabled`
Data Fixture @magentoDataFixture `@magentoDataFixture <script_filename> <method_name>`
Application Area @magentoAppArea `@magentoAppArea adminhtml frontend
Enable/Disable Cache @magentoCache `@magentoCache all enabled
Register Components @magentoComponentsDir @magentoComponentsDir <dir_path> Registers fixture components from specified directory (recursively). Unregisters the components after the test is finished.

Applying annotations

The Magento-specific annotations for integration tests are applied in the following order:

  1. @magentoAppIsolation
  2. @magentoDbIsolation
  3. @magentoDataFixture
  4. @magentoComponentsDir
  5. @magentoAppArea
  6. @magentoCache
  7. @magentoConfigFixture

This order is necessary to meet the requirement of setting up the store-scoped configuration values for fixture stores (stores that are created by data fixtures).