This repository has been archived by the owner on May 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
Using Fixtures
vsushkov edited this page Apr 5, 2012
·
2 revisions
To include fixtures for your test, you can use the annotation @loadFixtures. This optionally takes the name of the fixtures file, if you omit it the fixture loaded will be the one with the name of the test method.
For example:
class ..._MyTest extends EcomDev_PHPUnit_Test_Case{
/**
* @test
* @loadFixtures
*/
public function testSize(){
...
}
This will look for the file MyTest/fixtures/testSize.yaml.
class ..._MyTest extends EcomDev_PHPUnit_Test_Case{
/**
* @test
* @loadFixtures someTestfile
*/
public function testSize(){
...
}
This will look for the file MyTest/fixtures/someTestfile.yaml.
You can also tell to the testing framework to load fixtures for entire test case (class). This fixtures will be loaded in setUpBeforeClass and destroyed in tearDownAfterClass methods respectively. To use shared fixtures test class's doc block should contain @loadSharedFixture
annotation. Default shared fixture file name is default.yaml
.