protected function PathAliasTestTrait::loadPathAliasByConditions in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Traits/Core/PathAliasTestTrait.php \Drupal\Tests\Traits\Core\PathAliasTestTrait::loadPathAliasByConditions()
Gets the first result from a 'load by properties' storage call.
Parameters
array $conditions: An array of query conditions.
Return value
\Drupal\path_alias\PathAliasInterface|null A path alias entity or NULL.
4 calls to PathAliasTestTrait::loadPathAliasByConditions()
- MigrateUrlAliasTest::testUrlAlias in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUrlAliasTest.php - Test the url alias migration.
- MigrateUrlAliasTest::testUrlAliasWithTranslatedNodes in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d7/ MigrateUrlAliasTest.php - Test the URL alias migration with translated nodes.
- MigrateUrlAliasTest::testUrlAliasWithTranslatedNodes in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUrlAliasTest.php - Test the URL alias migration with translated nodes.
- MigrateUrlAliasTestBase::testUrlAlias in core/
modules/ path/ tests/ src/ Kernel/ Migrate/ d7/ MigrateUrlAliasTestBase.php - Test the URL alias migration.
File
- core/
tests/ Drupal/ Tests/ Traits/ Core/ PathAliasTestTrait.php, line 49
Class
- PathAliasTestTrait
- Provides methods to create and assert path_alias entities.
Namespace
Drupal\Tests\Traits\CoreCode
protected function loadPathAliasByConditions($conditions) {
$storage = \Drupal::entityTypeManager()
->getStorage('path_alias');
$query = $storage
->getQuery();
foreach ($conditions as $field => $value) {
$query
->condition($field, $value);
}
$entities = $storage
->loadMultiple($query
->execute());
return $entities ? reset($entities) : NULL;
}