3
* @link https://www.yiiframework.com/
4
* @copyright Copyright (c) 2008 Yii Software LLC
5
* @license https://www.yiiframework.com/license/
10
use yii\base\Component;
13
* Fixture represents a fixed state of a test environment.
15
* Each fixture instance represents a particular aspect of a test environment. For example,
16
* you may use `UserFixture` to initialize the user database table with a set of known data. You may
17
* load the fixture when running every test method so that the user table always contains the fixed data
18
* and thus allows your test predictable and repeatable.
20
* A fixture may depend on other fixtures, specified via the [[depends]] property. When a fixture is being loaded,
21
* its dependent fixtures will be automatically loaded BEFORE the fixture; and when the fixture is being unloaded,
22
* its dependent fixtures will be unloaded AFTER the fixture.
24
* You should normally override [[load()]] to specify how to set up a fixture; and override [[unload()]]
25
* for clearing up a fixture.
27
* For more details and usage information on Fixture, see the [guide article on fixtures](guide:test-fixtures).
29
* @author Qiang Xue <qiang.xue@gmail.com>
32
class Fixture extends Component
35
* @var array the fixtures that this fixture depends on. This must be a list of the dependent
36
* fixture class names.
43
* This method is called before performing every test method.
44
* You should override this method with concrete implementation about how to set up the fixture.
46
public function load()
51
* This method is called BEFORE any fixture data is loaded for the current test.
53
public function beforeLoad()
58
* This method is called AFTER all fixture data have been loaded for the current test.
60
public function afterLoad()
65
* Unloads the fixture.
66
* This method is called after every test method finishes.
67
* You may override this method to perform necessary cleanup work for the fixture.
69
public function unload()
74
* This method is called BEFORE any fixture data is unloaded for the current test.
76
public function beforeUnload()
81
* This method is called AFTER all fixture data have been unloaded for the current test.
83
public function afterUnload()