protected function LoadFixturesTrait::loadFixtureContent in YAML Content 8
Load content from a fixture file.
Parameters
$fixture_name: The name of the file to load.
array $collection_path: (optional) An array of keys to extract a subset of content from the file.
Return value
array Content loaded from the fixture.
3 calls to LoadFixturesTrait::loadFixtureContent()
- EntityLoadHelperTest::attributeCategorizationProvider in tests/
src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php - Data provider to test attribute categorization.
- EntityLoadHelperTest::getEntityDefinition in tests/
src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php - Get a mocked entity definition.
- EntityLoadHelperTest::getEntityFields in tests/
src/ Unit/ EntityLoadHelper/ EntityLoadHelperTest.php - Load fixture data for mapped entity fields.
File
- tests/
src/ Traits/ LoadFixturesTrait.php, line 34
Class
- LoadFixturesTrait
- A trait to support loading test fixture data.
Namespace
Drupal\Tests\yaml_content\TraitsCode
protected function loadFixtureContent($fixture_name, array $collection_path = []) {
$fixture = Yaml::decode(file_get_contents($this
->getFixturePath() . "/{$fixture_name}.yml"));
// Retrieve nested values if the option was provided.
if (!empty($collection_path)) {
$fixture = NestedArray::getValue($fixture, $collection_path);
}
return $fixture;
}