PHP Класс yii\test\Fixture
Each fixture instance represents a particular aspect of a test environment. For example,
you may use
UserFixture to initialize the user database table with a set of known data. You may
load the fixture when running every test method so that the user table always contains the fixed data
and thus allows your test predictable and repeatable.
A fixture may depend on other fixtures, specified via the [[depends]] property. When a fixture is being loaded,
its dependent fixtures will be automatically loaded BEFORE the fixture; and when the fixture is being unloaded,
its dependent fixtures will be unloaded AFTER the fixture.
You should normally override
Fixture::load to specify how to set up a fixture; and override
Fixture::unload
for clearing up a fixture.
For more details and usage information on Fixture, see the
guide article on fixtures.
Показать файл
Открыть проект
Примеры использования класса
Открытые свойства
Свойство |
Тип |
Описание |
|
$depends |
|
the fixtures that this fixture depends on. This must be a list of the dependent
fixture class names. |
|
Открытые методы
Метод |
Описание |
|
afterLoad ( ) |
This method is called AFTER all fixture data have been loaded for the current test. |
|
afterUnload ( ) |
This method is called AFTER all fixture data have been unloaded for the current test. |
|
beforeLoad ( ) |
This method is called BEFORE any fixture data is loaded for the current test. |
|
beforeUnload ( ) |
This method is called BEFORE any fixture data is unloaded for the current test. |
|
load ( ) |
Loads the fixture. |
|
unload ( ) |
Unloads the fixture. |
|
Описание методов
afterLoad()
публичный Метод
This method is called AFTER all fixture data have been loaded for the current test.
afterUnload()
публичный Метод
This method is called AFTER all fixture data have been unloaded for the current test.
beforeLoad()
публичный Метод
This method is called BEFORE any fixture data is loaded for the current test.
beforeUnload()
публичный Метод
This method is called BEFORE any fixture data is unloaded for the current test.
This method is called before performing every test method.
You should override this method with concrete implementation about how to set up the fixture.
This method is called after every test method finishes.
You may override this method to perform necessary cleanup work for the fixture.
Описание свойств
$depends публичное свойство
the fixtures that this fixture depends on. This must be a list of the dependent
fixture class names.