Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E722 Topic 1 Question 18 Discussion

Actual exam question for Adobe's AD0-E722 exam
Question #: 18
Topic #: 1
[All AD0-E722 Questions]

An external system integrates functionality of a product catalog search using Adobe Commerce GraphQL API. The Architect creates a new attribute my_attribute in the admin panel with frontend type select-Later, the Architect sees that Productlnterf ace already has the field my_attribute, but returns an Int value. The Architect wants this field to be a new type that contains both option id and label.

To meet this requirement, an Adobe Commerce Architect creates a new module and file etc/schema.graphqls that declares as follows:

After calling command setup:upgrade, the introspection of Productlnterface field my_attribute remains Int. What prevented the value type of field my_attribute from changing?

Show Suggested Answer Hide Answer
Suggested Answer: C

To create an integration test that executes different logic in different store views, the Architect needs to do the following steps:

Create one test class that extends MagentoTestFrameworkTestCaseAbstractController or MagentoTestFrameworkTestCaseAbstractBackendController, depending on the type of controller being tested1.

Create one test method that uses the @magentoDataFixture annotation to specify the data fixture file that creates the product2.

Use the MagentoTestFrameworkStoreExecuteInStoreContext class to execute the fixture and the tested logic in different store views. This class has a method called executeInStoreContext, which takes two parameters: the store ID and a callable function.The callable function will be executed in the context of the given store ID, and then the original store ID will be restored3. For example:

PHPAI-generated code. Review and use carefully.More info on FAQ.

public function testSomeLogic()

{

// Get the product from the fixture

$product = $this->getProduct();

// Get the ExecuteInStoreContext instance from the object manager

$executeInStoreContext = $this->_objectManager->get(MagentoTestFrameworkStoreExecuteInStoreContext::class);

// Execute the fixture in store view 3

$executeInStoreContext->executeInStoreContext(3, function () use ($product) {

// Do some operations on the product in store view 3

});

// Execute the tested logic in store view 4

$result = $executeInStoreContext->executeInStoreContext(4, function () use ($product) {

// Call the tested logic on the product in store view 4

return $this->someLogic->execute($product);

});

// Assert that the result is true

$this->assertTrue($result);

}


Integration tests | Magento 2 Developer Documentation

Data fixtures | Magento 2 Developer Documentation

MagentoTestFrameworkStoreExecuteInStoreContext | Magento 2 Developer Documentation

Contribute your Thoughts:

Kristel
27 days ago
The Architect should have consulted the Magic 8-Ball before making any changes. It would have clearly foreseen this outcome.
upvoted 0 times
...
Ben
1 months ago
Eve
upvoted 0 times
Orville
17 days ago
B) The fields of Productlnterface are checked during processing schema.graphqls files. If they have a corresponding attribute, then the backendjype of product attribute is set for field type.
upvoted 0 times
...
Anglea
21 days ago
A) The Magento_CatalogGraphQI module occurs later in sequence than the Magento_GraphQI module and merging output of dynamic attributes schema reader overrides types declared in schema.graphqls
upvoted 0 times
...
...
Mary
2 months ago
Hmm, that makes sense too. I guess we need to pay attention to the sequence of modules and keyword usage in GraphQL.
upvoted 0 times
...
Essie
2 months ago
I disagree, I believe the correct answer is C. Extending the interface ProductInterface requires the keyword extend before a new declaration.
upvoted 0 times
...
Mary
2 months ago
I think the answer is A. The merging output of dynamic attributes schema reader can override types declared in schema.graphqls.
upvoted 0 times
...

Save Cancel