When alice fixture files are loaded out of order, this ensures all the generated models have their required associations after Alice is finished generating.
For example:
When there are two fixture files and one references models from the other like
# ./feature/fixtures/products.yml
Product:
product-a:
name: Product A
category '@category-a'
#./features/fixtures/categories.yml
Category:
category:
category-a:
name: Category A
If AliceContext ends up loading them out of order i.e. $aliceLoader->loadFiles(['product.yml', 'category.yml']) the models are still generated without error; But, the Product model's category is NULL.
My example above is very much simplified but should describe the problem. I've only experienced this issue when using multiple @alice() tags with large & complex dependencies defined in behat.yml.
This PR adds an additional 'pass' that searches the generated models for associations in the spec that have NULL values and corrects them.
When alice fixture files are loaded out of order, this ensures all the generated models have their required associations after Alice is finished generating.
For example: When there are two fixture files and one references models from the other like
If
AliceContext
ends up loading them out of order i.e.$aliceLoader->loadFiles(['product.yml', 'category.yml'])
the models are still generated without error; But, theProduct
model'scategory
isNULL
.My example above is very much simplified but should describe the problem. I've only experienced this issue when using multiple
@alice()
tags with large & complex dependencies defined inbehat.yml
.This PR adds an additional 'pass' that searches the generated models for associations in the spec that have
NULL
values and corrects them.