ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 11 - AD0-E716 discussion

Report
Export

An Adobe Commerce developer is writing an integration test. They checked some Integration Tests for Magento core modules for reference and noticed that they use data fixtures initialized by adding annotations to test classes. For example:

The developer wants to add their own fixture to test a MyVendor_MyModule they created. Which steps will make this possible?

A.
1- Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_fiies/my_fixture.php.2- Add the following annotation to the test method:
Answers
A.
1- Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_fiies/my_fixture.php.2- Add the following annotation to the test method:
B.
1- Create a PHP file With the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php.2- Add the following annotation to the test method:
Answers
B.
1- Create a PHP file With the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php.2- Add the following annotation to the test method:
C.
1- Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_f iies/my_f ixture.php.2- Add the following annotation to the test method:
Answers
C.
1- Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_f iies/my_f ixture.php.2- Add the following annotation to the test method:
Suggested answer: B

Explanation:

To add a custom fixture to test a MyVendor_MyModule, the developer needs to do the following:

Create a PHP file with the fixture data in[magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php.

Add the following annotation to the test method:

@magentoDataFixture(

'testsuite/MyVendor/MyModule/_files/my_fixture.php'

)

This will tell Magento to load the fixture data from the my_fixture.php file before the test method is executed.

asked 02/10/2024
Christopher Harden
46 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first