I am currently writing my first unit test. The basis of the test is I get all of the order information along with the items and create a JSON object from it. Is there a way to create dummy items and orders with preset data?
You're looking for "fixtures"– scrowlerMay 24, 2016 at 0:10
You should distinguish between unit and integration tests.
In a unit test the class under test should get the order data from a collaborator that you can inject as a mock, for example the
If you want to get test order data from the database, consider writing an integration test instead of a unit test.
Then use the
@magentoDataFixture Magento/Sales/_files/order.php annotation to create a test order fixture for the test.