From 6718216fd25e8519d9bc7504a90910534bcc68ab Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 31 Jul 2019 09:30:04 +0300 Subject: [PATCH 1/3] magento/devdocs#: Add documentation about @magentoConfigFixture annotation to "GraphQL functional testing" https://devdocs.magento.com/guides/v2.3/graphql/functional-testing.html --- guides/v2.3/graphql/functional-testing.md | 46 ++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/guides/v2.3/graphql/functional-testing.md b/guides/v2.3/graphql/functional-testing.md index 383a42e41b5..4cfb53e0273 100644 --- a/guides/v2.3/graphql/functional-testing.md +++ b/guides/v2.3/graphql/functional-testing.md @@ -95,7 +95,7 @@ A fixture consists of two files: - The fixture file, which defines the test - A rollback file, which reverts the system to the state before the test was run -{:.bs-callout .bs-callout-info} +{: .bs-callout-info } Each fixture should have a corresponding rollback file. Magento provides fixtures in the `dev/tests/integration/testsuite/Magento//_files` directory. Use these fixtures whenever possible. When you create your own fixture, also create a proper rollback. @@ -196,6 +196,50 @@ $registry->unregister('isSecureArea'); $registry->register('isSecureArea', false); ``` +### Fixture configs + +Use `@magentoConfigFixture` annotation to set a custom config value. It supports a `store` scope only. + +#### Syntax + +```php +/** + * @magentoConfigFixture _store + */ +``` + +where +- `` - Code of store. See `store`.`code` table +- `` - Config key. See `core_config_data`.`path` +- `` - Config value. See `core_config_data`.`value` + +{: .bs-callout-info } +`@magentoConfigFixture` does not require a roll-back. + +#### Example usage + +The following example sets a store-scoped value `1` for the config key `checkout/options/enable_agreements` for the `default` store in the `GetActiveAgreement()` test: + +```php + /** + * @magentoConfigFixture default_store checkout/options/enable_agreements 1 + */ + public function testGetActiveAgreement() + { + ... + } +``` + +In the background process, `@magentoConfigFixture` do the next before test execution: + +```sql +INSERT INTO `core_config_data` (scope`, `scope_id`, `path`, `value`) +VALUES + ('stores', 1, 'checkout/options/enable_agreements', '1'); +``` + +and automatically removes `checkout/options/enable_agreements` config key from database when test be completed. + ## Defining expected exceptions Your functional tests should include events that cause exceptions. Since your tests expect an exception to occur, set up your tests so that they elicit the proper responses. You can define expected exception messages either in: From 5ccf5ede04e5e9fa4675d75f3ec9205833df0e56 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 31 Jul 2019 15:41:53 +0300 Subject: [PATCH 2/3] magento/devdocs#: Add documentation about @magentoConfigFixture annotation to "GraphQL functional testing" --- guides/v2.3/graphql/functional-testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/functional-testing.md b/guides/v2.3/graphql/functional-testing.md index 4cfb53e0273..89f37d2b817 100644 --- a/guides/v2.3/graphql/functional-testing.md +++ b/guides/v2.3/graphql/functional-testing.md @@ -209,7 +209,7 @@ Use `@magentoConfigFixture` annotation to set a custom config value. It supports ``` where -- `` - Code of store. See `store`.`code` table +- `` - Store code. See the `store`.`code` database field value. - `` - Config key. See `core_config_data`.`path` - `` - Config value. See `core_config_data`.`value` @@ -230,7 +230,7 @@ The following example sets a store-scoped value `1` for the config key `checkout } ``` -In the background process, `@magentoConfigFixture` do the next before test execution: +In the background process, `@magentoConfigFixture` performs the following action before test execution: ```sql INSERT INTO `core_config_data` (scope`, `scope_id`, `path`, `value`) @@ -238,7 +238,7 @@ VALUES ('stores', 1, 'checkout/options/enable_agreements', '1'); ``` -and automatically removes `checkout/options/enable_agreements` config key from database when test be completed. +and automatically removes `checkout/options/enable_agreements` config key from the database after the test has been completed. ## Defining expected exceptions From b8f3a776d397cb9d351943bda00a62cd92a824a3 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Wed, 31 Jul 2019 18:19:18 +0300 Subject: [PATCH 3/3] magento/devdocs#: Add documentation about @magentoConfigFixture annotation to "GraphQL functional testing" --- guides/v2.3/graphql/functional-testing.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guides/v2.3/graphql/functional-testing.md b/guides/v2.3/graphql/functional-testing.md index 89f37d2b817..4da42cb4492 100644 --- a/guides/v2.3/graphql/functional-testing.md +++ b/guides/v2.3/graphql/functional-testing.md @@ -198,7 +198,7 @@ $registry->register('isSecureArea', false); ### Fixture configs -Use `@magentoConfigFixture` annotation to set a custom config value. It supports a `store` scope only. +Use the `@magentoConfigFixture` annotation to set a custom config value. It supports a `store` scope only. #### Syntax @@ -230,7 +230,7 @@ The following example sets a store-scoped value `1` for the config key `checkout } ``` -In the background process, `@magentoConfigFixture` performs the following action before test execution: +`@magentoConfigFixture` performs the following action as a background process before test execution: ```sql INSERT INTO `core_config_data` (scope`, `scope_id`, `path`, `value`) @@ -238,7 +238,7 @@ VALUES ('stores', 1, 'checkout/options/enable_agreements', '1'); ``` -and automatically removes `checkout/options/enable_agreements` config key from the database after the test has been completed. +The fixture automatically removes the `checkout/options/enable_agreements` config key from the database after the test has been completed. ## Defining expected exceptions