I set up unit tests for Magento 1.9.1.0 using EcomDev PHPUnit. I was able to make almost everything working properly. The only thing which I haven't figured out is how to use fixtures in multiple database setup.
There are two database resources set in local.xml
:
default_setup
used by the whole codebase as default connectionmy_extension
used by one custom extension, declared in moduleconfig.xml
Then I have following fixtures in default.yaml
file:
aliases:
user: &user
id: 1
login: john
password: foo
email: [email protected]
customer_id: 1
firstname: John
lastname: Doe
customer_id: 1
tables:
my_extension/user:
-
<<: *user
id: 1
eav:
customer:
-
<<: *eav_customer
entity_id: 1
firstname: John
lastname: Smith
email: [email protected]
I would like to have eav/customer
fixture added using default_setup
resource and my_extension/user
fixture added using my_extension
resource.
As far as I see in EcomDev_PHPUnit_Model_Fixture_Processor_Tables
, it always uses default resource.
For now I just configured test Magento environment to have both resources using the same database.
Do you know any elegant way to make fixtures working with different resources?