I do not find in the docks how to set fibacks for tests. Those. Some test data for each table. I think I would ideally even have a separate test database, but I would like it to be filled with tests and cleared at the end. So that if something has changed in it – then when you restart tests, everything was as new. For example, in the root of tests there is a _Data folder, it seems to be shovel in it? But in what format? And how to pick them up then? I would like a simple array or JSON to indicate to simply change if necessary. All the same data is not necessary for tests.
And another question I am very worried: how to perform something before and after all tests (within one file at least)? Tests have _before and _After methods, but they are performed before and after each test method, and I need before and after all test methods (at least within one test class). For example, the same fibackists make no sense to pour and purify before / after each method and there are different tasks.
Answer 1, Authority 100%
Fixists (eng. Fixtures) is an important component of testing. Their main task is to prepare the environment with a pre-fixed / known state to guarantee the repeatability of the testing process. Yii provides a framework that allows you to easily and accurately determine the fits and use them in your tests.
The key concept in the Fixtur Fixtur framework is the so-called fiback object. The fiback object is a special aspect of the test environment, which is inherited from Yii \ Test \ Fixture or its heirs. For example, you can use userfixture in order to be sure that the user table contains a known set of data. You download one or more ficture objects before starting the test and unload them after it is completed.
FiKstur may depend on other fictures specified through the Yii \ Test property property :: $ depends. When the fixture is loaded, the fits from which it depends will be automatically loaded to it, and when it is unloaded all dependent fits will be unloaded after it.
(https://www.yiiframework.com/doc/guide/2.0 / RU / Test-Fixtures )