diff --git a/core/modules/entity_reference/entity_reference.views.inc b/core/modules/entity_reference/entity_reference.views.inc index 9d1f14f..6915452 100644 --- a/core/modules/entity_reference/entity_reference.views.inc +++ b/core/modules/entity_reference/entity_reference.views.inc @@ -13,7 +13,7 @@ */ function entity_reference_field_views_data(FieldConfigInterface $field) { $data = field_views_field_default_views_data($field); - $entity_manager = Drupal::entityManager(); + $entity_manager = \Drupal::entityManager(); foreach ($data as $table_name => $table_data) { // Add a relationship to the target entity type. $target_type = $field->getSetting('target_type'); @@ -24,7 +24,7 @@ function entity_reference_field_views_data(FieldConfigInterface $field) { // type. $args = array( '@label' => $target_entity_type->getLabel(), - '@field_name' => $field->getName() + '@field_name' => $field->getName(), ); $data[$table_name][$field->getName()]['relationship'] = array( 'id' => 'standard', diff --git a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php b/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php index 320da76..fe481ea 100644 --- a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php +++ b/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php @@ -8,19 +8,18 @@ namespace Drupal\entity_reference\Tests\Views; use Drupal\Core\Field\FieldStorageDefinitionInterface; -use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldInstanceConfig; -use Drupal\views\Tests\ViewTestBase; use Drupal\views\Tests\ViewTestData; +use Drupal\views\Tests\ViewUnitTestBase; use Drupal\views\Views; /** * Defines a test for the entity_reference views relationship. * - * @see entity_reference_field_views_data + * @see entity_reference_field_views_data() */ -class EntityReferenceRelationshipTest extends ViewTestBase { +class EntityReferenceRelationshipTest extends ViewUnitTestBase { /** * Views used by this test. @@ -34,7 +33,7 @@ class EntityReferenceRelationshipTest extends ViewTestBase { * * @var array */ - public static $modules = array('field', 'entity_test', 'options', 'entity_reference', 'views', 'entity_reference_test_views'); + public static $modules = array('user', 'field', 'entity_test', 'options', 'entity_reference', 'views', 'entity_reference_test_views'); /** * The entity_test entities used by the test. @@ -43,6 +42,9 @@ class EntityReferenceRelationshipTest extends ViewTestBase { */ protected $entities = array(); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Entity Reference: Relationship handler', @@ -51,9 +53,14 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->installEntitySchema('entity_test'); + ViewTestData::createTestViews(get_class($this), array('entity_reference_test_views')); $field = FieldConfig::create(array(