Total Complexity | 7 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 81.82% |
Changes | 0 |
1 | <?php |
||
19 | trait FileFixtureTrait |
||
20 | { |
||
21 | /** |
||
22 | * @var string the directory path or [path alias](guide:concept-aliases) that contains the fixture data |
||
23 | */ |
||
24 | public $dataDirectory; |
||
25 | /** |
||
26 | * @var string|bool the file path or [path alias](guide:concept-aliases) of the data file that contains the fixture data |
||
27 | * to be returned by [[getData()]]. You can set this property to be false to prevent loading any data. |
||
28 | */ |
||
29 | public $dataFile; |
||
30 | |||
31 | /** |
||
32 | * Returns the fixture data. |
||
33 | * |
||
34 | * The default implementation will try to return the fixture data by including the external file specified by [[dataFile]]. |
||
35 | * The file should return the data array that will be stored in [[data]] after inserting into the database. |
||
36 | * |
||
37 | * @param string $file the data file path |
||
38 | * @param bool $throwException whether to throw exception if fixture data file does not exist. |
||
39 | * @return array the data to be put into the database |
||
40 | * @throws InvalidConfigException if the specified data file does not exist. |
||
41 | */ |
||
42 | 3 | protected function loadData($file, $throwException = true) |
|
64 |