PROFESSIONAL DEVELOPER TEST POOL-02 (MAGENTO 2 CERTIFIED )

Descrição

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),
Dario Dorfelli
Quiz por Dario Dorfelli, atualizado more than 1 year ago Mais Menos
Miska Red
Criado por Miska Red aproximadamente 5 anos atrás
Dario Dorfelli
Copiado por Dario Dorfelli aproximadamente 5 anos atrás
1240
2

Resumo de Recurso

Questão 1

Questão
You 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?
Responda
  • Plugins do not work on a class that is declared final
  • The XML definition does not define the method the plugin is intercepting
  • Plugins do not work on a class that contains a final public method
  • The XML definition should be defined within plugins.xml and not di.xml

Questão 2

Questão
You 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?
Responda
  • Sort order should not be specified as a string.
  • SearchCriteriaBuilder should be used instead of SearchCriteria.
  • One line 2, when loading $search, you need to use $search->getCriteria().
  • Sort orders must be added one at a time with the addSortOrder method.

Questão 3

Questão
You are building a customization for Magento sites that must change the template for the customer account order history view. How do you accomplish this?
Responda
  • Override \Magento\Sales\Block\Order\History and specify a new $_template variable.
  • In sales_order_history.xml add: <referenceBlock name=”sales.order.history”><arguments><argument name=”template” xsi:type=”string”>...</argument></arguments>
  • Create an after plugin for the \Magento\Sales\Block\Order\History::setTemplate.
  • In sales_order_history.xml add: <referenceBlock name=”sales.order.history” template=”...”/>

Questão 4

Questão
You 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?
Responda
  • Add an extension attribute to OrderInterface
  • Create a new REST API endpoint to fetch the comments per order.
  • Ensure the comments key is in the Order model’s $data array.
  • Override the Order model to add a getComments method.

Questão 5

Questão
There 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?
Responda
  • Around plugin
  • Event observer
  • After plugin
  • Before plugin

Questão 6

Questão
You 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?
Responda
  • \Magento\CatalogInventory\Api\StockRegistryInterface
  • \Magento\Catalog\Api\ProductRepositoryInterface
  • \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
  • \Magento\Ui\DataProvider\AbstractDataProvider

Questão 7

Questão
How would you create a custom product attribute which is only applicable to bundle products?
Responda
  • By setting the attribute’s apply_to property yo “bundle”
  • By creating a backend model that checks the product type parameter and throws an exception…... different from bundle.
  • By creating a special attribute set for these products and assigning only bundle pr….
  • By setting the attribute’s attribute_model property to “bundle”

Questão 8

Questão
Which two use cases would be valid causes to create a new block type? Choose 2 answers.
Responda
  • You need to change how the cache key is generated for multiple blocks
  • You want to hard code the template path for a block used multiple times……
  • You need to add custom data to the template
  • You need to change the behavior of the rendering methods……

Questão 9

Questão
You 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…….
Responda
  • Load the ExternalCustomerDataInterface instance and set it on the customers….
  • Create after* plugins on all methods of the CustomerRepositoryInterface…… instances
  • Add the getters and setters for the extension attribute to the \Magento\Customer\Api\Data\CustomerMetaDataInterface
  • Create an afterLoad plugin on \Magento\Customer\Model\ReesourceModel\Customer…... ExternalCustomerDataInterface instance to the loaded customer.
  • If the customer instance method getExtensionAttributes() returns null………. Extension attribute on.

Questão 10

Questão
Which three types of relations between blocks and templates are configured via layout XML? Choose 3 answers
Responda
  • Multiple block instances can be used from the same templates.
  • Multiple block instances of the same class can use the same template.
  • Multiple templates can be assigned to different instances of the same block class.
  • Multiple block classes can use the same template.
  • Multiple templates can be assigned to the same block instance.

Semelhante

Magento 2 Front-end Developer Certification Practice Exam
Érika Giroux
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Miska Red
Magento 2 Cloud
Oleksiy P
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Станислав Матявин
Magento Backend Test
eddie0236
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
Dario Dorfelli
Magento 2 Front-end Developer Certification Practice Exam
Sanjay Antala
M2 FE - OPV
Vladyslav Opuhliy
PROFESSIONAL DEVELOPER TEST POOL-1 (MAGENTO 2 CERTIFIED )
test test
Magento 2 Front-end Developer Certification Practice Exam
Keerthana S
Magento 2 Front-end Developer Certification Practice Exam
asdsad sdfadad