test\ArrayFixture getData()

getData() protected method Returns the fixture data. The default implementation will try to return the fixture data by including the external file specified by $dataFile. The file should return the data array that will be stored in $data after inserting into the database. protected array getData ( )return array The data to be put into the database throws yii\base\InvalidConfigException if the specified data file does not exist.

test\ArrayFixture $data

$data public property The data rows. Each array element represents one row of data (column name => column value). public array $data = []

test\ActiveFixture resetTable()

resetTable() protected method Removes all existing data from the specified table and resets sequence number to 1 (if any). This method is called before populating fixture data into the table associated with this fixture. protected void resetTable ( )

test\ArrayFixture $dataFile

$dataFile public property The file path or path alias of the data file that contains the fixture data to be returned by getData(). You can set this property to be false to prevent loading any data. public string|boolean $dataFile = null

test\ActiveFixture init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

test\ActiveFixture load()

load() public method Loads the fixture. The default implementation will first clean up the table by calling resetTable(). It will then populate the table with the data returned by getData(). If you override this method, you should consider calling the parent implementation so that the data returned by getData() can be populated into the table. public void load ( )

test\ActiveFixture getData()

getData() protected method Returns the fixture data. The default implementation will try to return the fixture data by including the external file specified by $dataFile. The file should return an array of data rows (column name => column value), each corresponding to a row in the table. If the data file does not exist, an empty array will be returned. protected array getData ( )return array The data rows to be inserted into the database table.

test\ActiveFixture getTableSchema()

getTableSchema() public method public yii\db\TableSchema getTableSchema ( )return yii\db\TableSchema The schema information of the database table associated with this fixture. throws yii\base\InvalidConfigException if the table does not exist

Testing

Developing with tests When and how to test Further reading Testing is an important part of software development. Whether we are aware of it or not, we conduct testing continuously. For example, when we write a class in PHP, we may debug it step by step or simply use echo or die statements to verify the implementation works according to our initial plan. In the case of a web application, we're entering some test data in forms to ensure the page interacts with us as expected. The testing process

test\ActiveFixture $tableName

$tableName public property The name of the database table that this fixture is about. If this property is not set, the table name will be determined via $modelClass. See also $modelClass. public string $tableName = null