Commit a371a7b5 authored by alexpott's avatar alexpott

Issue #1986888 by tim.plunkett, agentrickard: Fixed Field UI integration for...

Issue #1986888 by tim.plunkett, agentrickard: Fixed Field UI integration for entity types is brittle.
parent 19e6c2c0
......@@ -49,6 +49,7 @@ public static function getSubscribedEvents() {
public function routes(RouteBuildEvent $event) {
$collection = $event->getRouteCollection();
foreach ($this->manager->getDefinitions() as $entity_type => $entity_info) {
$defaults = array();
if ($entity_info['fieldable'] && isset($entity_info['route_base_path'])) {
$path = $entity_info['route_base_path'];
......
<?php
/**
* @file
* Contains \Drupal\field_ui\Tests\FieldUIRouteTest.
*/
namespace Drupal\field_ui\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Tests the functionality of the Field UI route subscriber.
*/
class FieldUIRouteTest extends WebTestBase {
/**
* Modules to enable.
*/
public static $modules = array('field_ui_test', 'node');
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Field UI routes',
'description' => 'Tests the functionality of the Field UI route subscriber.',
'group' => 'Field UI',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
$this->drupalLogin($this->root_user);
}
/**
* Ensures that entity types with bundles do not break following entity types.
*/
public function testFieldUIRoutes() {
$this->drupalGet('field-ui-test-no-bundle/manage/fields');
$this->assertText('No fields are present yet.');
$this->drupalGet('admin/structure/types/manage/article/fields');
$this->assertTitle('Article | Drupal');
}
}
name: "Field UI tests"
type: module
description: "Support module for Field UI testing."
package: Testing
version: VERSION
core: 8.x
hidden: TRUE
dependencies:
- field_ui
<?php
/**
* @file
* Contains \Drupal\field_ui_test\Plugin\Core\Entity\FieldUITestNoBundle.
*/
namespace Drupal\field_ui_test\Plugin\Core\Entity;
use Drupal\Core\Entity\Entity;
use Drupal\Core\Entity\Annotation\EntityType;
use Drupal\Core\Annotation\Translation;
/**
* Defines the test Field UI class.
*
* @EntityType(
* id = "field_ui_test_no_bundle",
* label = @Translation("Test Field UI entity, no bundle"),
* module = "field_ui_test",
* controllers = {
* "storage" = "Drupal\Core\Entity\DatabaseStorageController"
* },
* fieldable = TRUE,
* route_base_path = "field-ui-test-no-bundle/manage"
* )
*/
class FieldUITestNoBundle extends Entity {
/**
* The entity ID.
*
* @var int
*/
public $id;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment