Test
PROFESSIONAL DEVELOPER TEST POOL-02 (MAGENTO 2 CERTIFIED )
Este test tiene tiempo límite, así que se abre en el reproductor de siempre.
Preguntas del test (10)
1You are debugging a before plugin implementation on the authenticate method of a third
party extension’s class that is not being called. The definition of the plugin within your
module’s di.xml is:
<type name=”Extension\Module\Service\AuthProvider”>
<plugin name=”authentication”
type=”MyCompany\MyModule\Plugin\Service\AuthProvider” />
</type>
The structure of the third party class is:
final class AuthProvider {
final public function hashToken();
public function authenticate();
private function send();
} What is causing the plugin on the authenticate method to not work as expected?- APlugins do not work on a class that is declared final
- BThe XML definition does not define the method the plugin is intercepting
- CPlugins do not work on a class that contains a final public method
- DThe XML definition should be defined within plugins.xml and not di.xml
2You have injected \Magento\Framework\Api\SearchCriteria into the constructor method. You then wrote the following code in a method:
1: $search = $this->searchCriteria->setSortOrders([‘entity_id ASC’]);
2: $this->productRepository>getList($search);
When running this code, you get an error: Fatal error: Uncaught TypeError: Argument 1 must be an instance of SortOrder, string given. What are two errors present in the examples given?- ASort order should not be specified as a string.
- BSearchCriteriaBuilder should be used instead of SearchCriteria.
- COne line 2, when loading $search, you need to use $search->getCriteria().
- DSort orders must be added one at a time with the addSortOrder method.
3You are building a customization for Magento sites that must change the template for the customer account order history view. How do you accomplish this?
- AOverride \Magento\Sales\Block\Order\History and specify a new $_template variable.
- BIn sales_order_history.xml add: <referenceBlock name=”sales.order.history”><arguments><argument name=”template” xsi:type=”string”>...</argument></arguments>
- CCreate an after plugin for the \Magento\Sales\Block\Order\History::setTemplate.
- DIn sales_order_history.xml add: <referenceBlock name=”sales.order.history” template=”...”/>
4You are customizing a Magento website that will be connected to an ERP through the REST API. Also on this website, you have written a way for a customer to add comments to the order. These comments need to be sent to the ERP. Keeping maintainability in mind, how do you accomplish this?
- AAdd an extension attribute to OrderInterface
- BCreate a new REST API endpoint to fetch the comments per order.
- CEnsure the comments key is in the Order model’s $data array.
- DOverride the Order model to add a getComments method.
5There is a method which returns an entity:
public function get($entityId, $editMode = false) {
$entity = $this→entityLoader→load($entityId);
return $entity;
}
You need to log all ocurrences of the entity being loaded successfully, along with the selected
edit mode. What mechanism achieves this with the smallest increase of the call stack?- AAround plugin
- BEvent observer
- CAfter plugin
- DBefore plugin
6You are creating a module Micro Inventory that can update product stock quickly and also some feature, you implement public function resupply($productId, $qty) {
$product = $this->productRepository->getById($productId);
$stockItem = $this->stockRegistry->getStockItemBySku($product->getSku());
$stockItem->setQty($stockItem->getQty() + $qty);
$stockItem->setIsInStock((bool)$stockItem->getQty());
$this->stockRegistry->updateStockItemBySku($product->getSku(), $stockItem);
}
Where is stockRegistry?- A\Magento\CatalogInventory\Api\StockRegistryInterface
- B\Magento\Catalog\Api\ProductRepositoryInterface
- C\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
- D\Magento\Ui\DataProvider\AbstractDataProvider
7How would you create a custom product attribute which is only applicable to bundle products?
- ABy setting the attribute’s apply_to property yo “bundle”
- BBy creating a backend model that checks the product type parameter and throws an exception…... different from bundle.
- CBy creating a special attribute set for these products and assigning only bundle pr….
- DBy setting the attribute’s attribute_model property to “bundle”
8Which two use cases would be valid causes to create a new block type? Choose 2 answers.
- AYou need to change how the cache key is generated for multiple blocks
- BYou want to hard code the template path for a block used multiple times……
- CYou need to add custom data to the template
- DYou need to change the behavior of the rendering methods……
9You are creating an extension attribute on the customer entity to link data obtained from an
external CRM system. The custom interface
\MyCompany\MyCrm\Api\Data\ExternalCustomerDataInterface contains the accessors for the
data.
You already have implemented the interface and configured it with a <preference> node in
di.xml
The extension attribute is also registered in your modules etc/extension_attributes.xml file. Which 3 other steps are required to make this class available as an extension attribute on
cus…….- ALoad the ExternalCustomerDataInterface instance and set it on the customers….
- BCreate after* plugins on all methods of the CustomerRepositoryInterface……
instances - CAdd the getters and setters for the extension attribute to the
\Magento\Customer\Api\Data\CustomerMetaDataInterface - DCreate an afterLoad plugin on \Magento\Customer\Model\ReesourceModel\Customer…... ExternalCustomerDataInterface instance to the loaded customer.
- EIf the customer instance method getExtensionAttributes() returns null……….
Extension attribute on.
10Which three types of relations between blocks and templates are configured via layout XML? Choose 3 answers
- AMultiple block instances can be used from the same templates.
- BMultiple block instances of the same class can use the same template.
- CMultiple templates can be assigned to different instances of the same block class.
- DMultiple block classes can use the same template.
- EMultiple templates can be assigned to the same block instance.
Información
- Descripción
- POOL-1 30 question, This only my study notes, questions will NOT be found on the final exam. They might be similar. 60 questions 90mi 64%(more than 39) to pass Based on Magento Open Source (2.3) and Magento Commerce (2.3),
- Autor
- Dario Dorfelli
- Idioma
- English
- Visitas
- 1.292
- Etiquetas
- Valoración
- 5,0 de 5 · 1 valoración Valora este test